<!doctype html>
<html lang="zh-CN">
<head>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    
    <meta name="referrer" content="no-referrer-when-downgrade">
    

    <title>python生成matplotlib的统计图 | Anttu&#39;s Blog</title>
    <meta property="og:title" content="python生成matplotlib的统计图 - Anttu&#39;s Blog">
    <meta property="og:type" content="article">
        
    <meta property="article:published_time" content='2021-04-30T00:29:47&#43;08:00'>
        
        
    <meta property="article:modified_time" content='2021-04-30T00:29:47&#43;08:00'>
        
    <meta name="Keywords" content="golang,go语言,go语言笔记,anttu,java,博客,bash,linux笔记,python笔记,公众号,小程序">
    <meta name="description" content="python生成matplotlib统计图">
        
    <meta name="author" content="Anttu">
    <meta property="og:url" content="https://anttu.gitee.io/post/2021-04-30-python_matplotlib/">
    <link rel="shortcut icon" href='/favicon.ico'  type="image/x-icon">

    <link rel="stylesheet" href='/css/normalize.css'>
    <link rel="stylesheet" href='/css/style.css'>
    <script type="text/javascript" src="//cdn.bootcdn.net/ajax/libs/jquery/3.4.1/jquery.min.js"></script>

    
    
    
    
    
    
        <link rel="stylesheet" href='/css/asciinema-player.css'>
    
</head>


<body>
    <header id="header" class="clearfix">
    <div class="container">
        <div class="col-group">
            <div class="site-name ">
                
                    <a id="logo" href="https://anttu.gitee.io/">
                        Anttu&#39;s Blog
                    </a>
                
                <p class="description">一位Java开发者，喜欢研究技术，同时也在学习Golang和Python中，对服务器、Linux使用比较熟悉。欢迎添加技术交流QQ群：655158296</p>
            </div>
            <div>
                <nav id="nav-menu" class="clearfix">
                    <a class="current" href="https://anttu.gitee.io/">首页</a>
                    
                    <a  href="https://anttu.gitee.io/archives/" title="归档">归档</a>
                    
                    <a  href="https://anttu.gitee.io/tags/" title="分类">分类</a>
                    
                    <a  href="https://anttu.gitee.io/about/" title="关于">关于</a>
                    
                </nav>
            </div>
        </div>
    </div>
</header>

    <div id="body">
        <div class="container">
            <div class="col-group">

                <div class="col-8" id="main">
                    
<div class="res-cons">
    <style type="text/css">
    .post-toc {
        position: fixed;
        width: 200px;
        margin-left: -210px;
        padding: 5px 10px;
        font-family: Athelas, STHeiti, Microsoft Yahei, serif;
        font-size: 12px;
        border: 1px solid rgba(0, 0, 0, .07);
        border-radius: 5px;
        background-color: rgba(255, 255, 255, 0.98);
        background-clip: padding-box;
        -webkit-box-shadow: 1px 1px 2px rgba(0, 0, 0, .125);
        box-shadow: 1px 1px 2px rgba(0, 0, 0, .125);
        word-wrap: break-word;
        white-space: nowrap;
        -webkit-box-sizing: border-box;
        box-sizing: border-box;
        z-index: 999;
        cursor: pointer;
        max-height: 70%;
        overflow-y: auto;
        overflow-x: hidden;
    }

    .post-toc .post-toc-title {
        width: 100%;
        margin: 0 auto;
        font-size: 20px;
        font-weight: 400;
        text-transform: uppercase;
        text-align: center;
    }

    .post-toc .post-toc-content {
        font-size: 15px;
    }

    .post-toc .post-toc-content>nav>ul {
        margin: 10px 0;
    }

    .post-toc .post-toc-content ul {
        padding-left: 20px;
        list-style: square;
        margin: 0.5em;
        line-height: 1.8em;
    }

    .post-toc .post-toc-content ul ul {
        padding-left: 15px;
        display: none;
    }

    @media print,
    screen and (max-width:1057px) {
        .post-toc {
            display: none;
        }
    }
</style>
<div class="post-toc" style="position: absolute; top: 188px;">
    <h2 class="post-toc-title">文章目录</h2>
    <div class="post-toc-content">
        <nav id="TableOfContents">
  <ul>
    <li><a href="#前言">前言</a></li>
    <li><a href="#1准备工作">1、准备工作</a>
      <ul>
        <li><a href="#11-安装pandas和matplotlib">1.1 安装pandas和matplotlib</a></li>
        <li><a href="#12-安装numpy">1.2 安装numpy</a></li>
        <li><a href="#13-中文字体">1.3 中文字体</a></li>
        <li><a href="#14-pyplot支持中文的参数和字体样式">1.4 pyplot支持中文的参数和字体样式</a></li>
        <li><a href="#15-支持负号">1.5 支持负号</a></li>
        <li><a href="#16-其他常用参数介绍">1.6 其他常用参数介绍</a></li>
      </ul>
    </li>
    <li><a href="#2pandas解析数据">2、pandas解析数据</a>
      <ul>
        <li><a href="#21-导入数据">2.1 导入数据</a></li>
        <li><a href="#22-数据选取">2.2 数据选取</a></li>
        <li><a href="#23-数据处理">2.3 数据处理</a></li>
        <li><a href="#24-分组排序透视">2.4 分组、排序、透视</a></li>
        <li><a href="#25-数据合并">2.5 数据合并</a></li>
        <li><a href="#26-数据导出">2.6 数据导出</a></li>
        <li><a href="#27-查看数据">2.7 查看数据</a></li>
      </ul>
    </li>
    <li><a href="#3matplotlib生成统计图">3、matplotlib生成统计图</a>
      <ul>
        <li><a href="#31-折线图">3.1 折线图</a></li>
        <li><a href="#32-柱状图">3.2 柱状图</a></li>
        <li><a href="#33-堆积柱状图">3.3 堆积柱状图</a></li>
        <li><a href="#34-饼状图">3.4 饼状图</a></li>
        <li><a href="#35-散点图">3.5 散点图</a></li>
        <li><a href="#36-漏斗图">3.6 漏斗图</a></li>
        <li><a href="#37-雷达图">3.7 雷达图</a></li>
        <li><a href="#38-数字地图">3.8 数字地图</a></li>
        <li><a href="#39-热力图">3.9 热力图</a></li>
        <li><a href="#310-气泡图">3.10 气泡图</a></li>
      </ul>
    </li>
    <li><a href="#5demo代码">5、demo代码</a></li>
  </ul>
</nav>
    </div>
</div>
<script type="text/javascript">
    $(document).ready(function () {
        var postToc = $(".post-toc");
        if (postToc.length) {
            var leftPos = $("#main").offset().left;
            if (leftPos < 220) {
                postToc.css({ "width": leftPos - 10, "margin-left": (0 - leftPos) })
            }

            var t = postToc.offset().top - 20,
                a = {
                    start: {
                        position: "absolute",
                        top: t
                    },
                    process: {
                        position: "fixed",
                        top: 20
                    },
                };
            $(window).scroll(function () {
                var e = $(window).scrollTop();
                e < t ? postToc.css(a.start) : postToc.css(a.process)
            })
        }

        if ($("#TableOfContents").children().length < 1) {
            $(".post-toc").remove();
        }
    })
</script>
    <article class="post">
        <header>
            <h1 class="post-title">python生成matplotlib的统计图</h1>
        </header>
        <date class="post-meta meta-date">
            2021年4月30日
        </date>
        
        <div class="post-meta">
            <span>|</span>
            
            <span class="meta-category">
                <a href='/categories/python' target="_blank">python</a>
            </span>
            
            <span class="meta-category">
                <a href='/categories/pandas' target="_blank">pandas</a>
            </span>
            
            <span class="meta-category">
                <a href='/categories/matplotlib' target="_blank">matplotlib</a>
            </span>
            
        </div>
        
        
        <div class="post-meta">
            <span id="busuanzi_container_page_pv">|<span id="busuanzi_value_page_pv"></span><span>
                    阅读</span></span>
        </div>
        
        
        <div class="clear" style="display: none">
            <div class="toc-article">
                <div class="toc-title">文章目录</div>
            </div>
        </div>
        
        <div class="post-content">
            <h2 id="前言">前言</h2>
<p>记录下python生成统计图的一些常规使用，主要是2D的统计图，3D的暂不涉及</p>
<h2 id="1准备工作">1、准备工作</h2>
<h3 id="11-安装pandas和matplotlib">1.1 安装pandas和matplotlib</h3>
<div class="highlight"><div style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">
<table style="border-spacing:0;padding:0;margin:0;border:0;"><tr><td style="vertical-align:top;padding:0;margin:0;border:0;">
<pre tabindex="0" style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">1
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">2
</span></code></pre></td>
<td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
<pre tabindex="0" style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>pip install pandas
</span></span><span style="display:flex;"><span>pip install matplotlib
</span></span></code></pre></td></tr></table>
</div>
</div><h3 id="12-安装numpy">1.2 安装numpy</h3>
<div class="highlight"><div style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">
<table style="border-spacing:0;padding:0;margin:0;border:0;"><tr><td style="vertical-align:top;padding:0;margin:0;border:0;">
<pre tabindex="0" style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">1
</span></code></pre></td>
<td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
<pre tabindex="0" style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>pip install numpy
</span></span></code></pre></td></tr></table>
</div>
</div><h3 id="13-中文字体">1.3 中文字体</h3>
<table>
<thead>
<tr>
<th>中文字体名</th>
<th>英文字体名</th>
</tr>
</thead>
<tbody>
<tr>
<td>宋体</td>
<td>SimSun</td>
</tr>
<tr>
<td>黑体</td>
<td>SimHei</td>
</tr>
<tr>
<td>微软雅黑</td>
<td>Microsoft YaHei</td>
</tr>
<tr>
<td>微软正黑体</td>
<td>Microsoft JhengHei</td>
</tr>
<tr>
<td>新宋体</td>
<td>NSimSun</td>
</tr>
<tr>
<td>新细明体</td>
<td>PMingLiU</td>
</tr>
<tr>
<td>细明体</td>
<td>MingLiU</td>
</tr>
<tr>
<td>标楷体</td>
<td>DFKai-SB</td>
</tr>
<tr>
<td>仿宋</td>
<td>FangSong</td>
</tr>
<tr>
<td>楷体</td>
<td>KaiTi</td>
</tr>
<tr>
<td>隶书</td>
<td>LiSu</td>
</tr>
<tr>
<td>幼圆</td>
<td>YouYuan</td>
</tr>
<tr>
<td>华文细黑</td>
<td>STXihei</td>
</tr>
<tr>
<td>华文楷体</td>
<td>STKaiti</td>
</tr>
<tr>
<td>华文宋体</td>
<td>STSong</td>
</tr>
<tr>
<td>华文中宋</td>
<td>STZhongsong</td>
</tr>
<tr>
<td>华文仿宋</td>
<td>STFangsong</td>
</tr>
<tr>
<td>方正舒体</td>
<td>FZShuTi</td>
</tr>
<tr>
<td>方正姚体</td>
<td>FZYaoti</td>
</tr>
<tr>
<td>华文彩云</td>
<td>STCaiyun</td>
</tr>
<tr>
<td>华文琥珀</td>
<td>STHupo</td>
</tr>
<tr>
<td>华文隶书</td>
<td>STLiti</td>
</tr>
<tr>
<td>华文行楷</td>
<td>STXingkai</td>
</tr>
<tr>
<td>华文新魏</td>
<td>STXinwei</td>
</tr>
</tbody>
</table>
<h3 id="14-pyplot支持中文的参数和字体样式">1.4 pyplot支持中文的参数和字体样式</h3>
<div class="highlight"><div style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">
<table style="border-spacing:0;padding:0;margin:0;border:0;"><tr><td style="vertical-align:top;padding:0;margin:0;border:0;">
<pre tabindex="0" style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 1
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 2
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 3
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 4
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 5
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 6
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 7
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 8
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 9
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">10
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">11
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">12
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">13
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">14
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">15
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">16
</span></code></pre></td>
<td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
<pre tabindex="0" style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-python" data-lang="python"><span style="display:flex;"><span><span style="color:#000;font-weight:bold">import</span> <span style="color:#555">matplotlib.pyplot</span> <span style="color:#000;font-weight:bold">as</span> <span style="color:#555">plt</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># 设置黑体，支持中文</span>
</span></span><span style="display:flex;"><span>plt<span style="color:#000;font-weight:bold">.</span>rcParams[<span style="color:#d14">&#39;font.sans-serif&#39;</span>] <span style="color:#000;font-weight:bold">=</span> [<span style="color:#d14">&#39;SimHei&#39;</span>]
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># 设置字体样式</span>
</span></span><span style="display:flex;"><span>plt<span style="color:#000;font-weight:bold">.</span>rcParams[<span style="color:#d14">&#39;font.family&#39;</span>] <span style="color:#000;font-weight:bold">=</span> <span style="color:#d14">&#39;sans-serif&#39;</span>
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># 设置字体大小</span>
</span></span><span style="display:flex;"><span>plt<span style="color:#000;font-weight:bold">.</span>rcParams[<span style="color:#d14">&#39;font.size&#39;</span>] <span style="color:#000;font-weight:bold">=</span> <span style="color:#d14">&#39;16&#39;</span>
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># 伸展字体，很少用</span>
</span></span><span style="display:flex;"><span>plt<span style="color:#000;font-weight:bold">.</span>rcParams[<span style="color:#d14">&#39;font.stretch&#39;</span>] <span style="color:#000;font-weight:bold">=</span> <span style="color:#d14">&#39;normal&#39;</span>
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># 字体样式</span>
</span></span><span style="display:flex;"><span>plt<span style="color:#000;font-weight:bold">.</span>rcParams[<span style="color:#d14">&#39;font.style&#39;</span>] <span style="color:#000;font-weight:bold">=</span> <span style="color:#d14">&#39;normal&#39;</span>
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># 小型大写字母，大写字母大一号，小写字母全部大写但是比大写小一号；中文没影响</span>
</span></span><span style="display:flex;"><span>plt<span style="color:#000;font-weight:bold">.</span>rcParams[<span style="color:#d14">&#39;font.variant&#39;</span>] <span style="color:#000;font-weight:bold">=</span> <span style="color:#d14">&#39;normal&#39;</span>
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># 字体粗细，比如加粗bold</span>
</span></span><span style="display:flex;"><span>plt<span style="color:#000;font-weight:bold">.</span>rcParams[<span style="color:#d14">&#39;font.weight&#39;</span>] <span style="color:#000;font-weight:bold">=</span> <span style="color:#d14">&#39;normal&#39;</span>
</span></span></code></pre></td></tr></table>
</div>
</div><p>这里的字体样式基本跟CSS的font一样<br>
具体可以参考CSS的font说明: <a href="https://www.w3school.com.cn/cssref/pr_font_font.asp">https://www.w3school.com.cn/cssref/pr_font_font.asp</a></p>
<h3 id="15-支持负号">1.5 支持负号</h3>
<div class="highlight"><div style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">
<table style="border-spacing:0;padding:0;margin:0;border:0;"><tr><td style="vertical-align:top;padding:0;margin:0;border:0;">
<pre tabindex="0" style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">1
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">2
</span></code></pre></td>
<td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
<pre tabindex="0" style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-python" data-lang="python"><span style="display:flex;"><span><span style="color:#998;font-style:italic"># 解决负号&#39;-&#39;显示为方块的问题</span>
</span></span><span style="display:flex;"><span>plt<span style="color:#000;font-weight:bold">.</span>rcParams[<span style="color:#d14">&#39;axes.unicode_minus&#39;</span>] <span style="color:#000;font-weight:bold">=</span> <span style="color:#000;font-weight:bold">False</span>
</span></span></code></pre></td></tr></table>
</div>
</div><h3 id="16-其他常用参数介绍">1.6 其他常用参数介绍</h3>
<h4 id="161-线条样式lines">1.6.1 线条样式：lines</h4>
<table>
<thead>
<tr>
<th>函数</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td>plt.rcParams[&rsquo;lines.linestyle&rsquo;] = &lsquo;-.&rsquo;</td>
<td>线条样式</td>
</tr>
<tr>
<td>plt.rcParams[&rsquo;lines.linewidth&rsquo;] = 3</td>
<td>线条宽度</td>
</tr>
<tr>
<td>plt.rcParams[&rsquo;lines.color&rsquo;] = &lsquo;blue&rsquo;</td>
<td>线条颜色</td>
</tr>
<tr>
<td>plt.rcParams[&rsquo;lines.marker&rsquo;] = None</td>
<td>默认标记</td>
</tr>
<tr>
<td>plt.rcParams[&rsquo;lines.markersize&rsquo;] = 6</td>
<td>标记大小</td>
</tr>
<tr>
<td>plt.rcParams[&rsquo;lines.markeredgewidth&rsquo;] = 0.5</td>
<td>标记附近的线宽</td>
</tr>
</tbody>
</table>
<h4 id="162-横纵轴xtickytick">1.6.2 横、纵轴：xtick、ytick</h4>
<table>
<thead>
<tr>
<th>函数</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td>plt.rcParams[&lsquo;xtick.labelsize&rsquo;]</td>
<td>横轴字体大小</td>
</tr>
<tr>
<td>plt.rcParams[&lsquo;ytick.labelsize&rsquo;]</td>
<td>纵轴字体大小</td>
</tr>
<tr>
<td>plt.rcParams[&lsquo;xtick.major.size&rsquo;]</td>
<td>x轴最大刻度</td>
</tr>
<tr>
<td>plt.rcParams[&lsquo;ytick.major.size&rsquo;]</td>
<td>y轴最大刻度</td>
</tr>
</tbody>
</table>
<h4 id="163-figure中的子图axes">1.6.3 figure中的子图：axes</h4>
<table>
<thead>
<tr>
<th>函数</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td>plt.rcParams[&lsquo;axes.titlesize&rsquo;]</td>
<td>子图的标题大小</td>
</tr>
<tr>
<td>plt.rcParams[&lsquo;axes.labelsize&rsquo;]</td>
<td>子图的标签大小</td>
</tr>
</tbody>
</table>
<h4 id="164-图像图片figuresavefig">1.6.4 图像、图片：figure、savefig</h4>
<table>
<thead>
<tr>
<th>函数</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td>plt.rcParams[&lsquo;figure.dpi&rsquo;]</td>
<td>图像分辨率</td>
</tr>
<tr>
<td>plt.rcParams[&lsquo;figure.figsize&rsquo;]</td>
<td>图像显示大小</td>
</tr>
<tr>
<td>plt.rcParams[&lsquo;savefig.dpi&rsquo;]</td>
<td>图片像素</td>
</tr>
</tbody>
</table>
<h2 id="2pandas解析数据">2、pandas解析数据</h2>
<p>常规用法，具体详细参数请参考官方: <a href="https://pandas.pydata.org/docs/user_guide/index.html#user-guide">https://pandas.pydata.org/docs/user_guide/index.html#user-guide</a></p>
<h3 id="21-导入数据">2.1 导入数据</h3>
<table>
<thead>
<tr>
<th>函数</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td>pd.DataFrame()</td>
<td>自己创建数据框，用于练习</td>
</tr>
<tr>
<td>pd.read_csv(filename)</td>
<td>从CSV⽂件导⼊数据</td>
</tr>
<tr>
<td>pd.read_table(filename)</td>
<td>从限定分隔符的⽂本⽂件导⼊数据</td>
</tr>
<tr>
<td>pd.read_excel(filename)</td>
<td>从Excel⽂件导⼊数据</td>
</tr>
<tr>
<td>pd.read_sql(query,connection_object)</td>
<td>从SQL表/库导⼊数据</td>
</tr>
<tr>
<td>pd.read_json(json_string)</td>
<td>从JSON格式的字符串导⼊数据</td>
</tr>
<tr>
<td>pd.read_html(url)</td>
<td>解析URL、字符串或者HTML⽂件，抽取其中的tables表格</td>
</tr>
</tbody>
</table>
<h3 id="22-数据选取">2.2 数据选取</h3>
<table>
<thead>
<tr>
<th>函数</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td>df[col]</td>
<td>根据列名，并以Series的形式返回列</td>
</tr>
<tr>
<td>df[[&ldquo;col1&rdquo;,&ldquo;col2&rdquo;]]</td>
<td>以DataFrame形式返回多列</td>
</tr>
<tr>
<td>s.iloc[0]</td>
<td>按位置选取数据</td>
</tr>
<tr>
<td>s.loc[&lsquo;index_one&rsquo;]</td>
<td>按索引选取数据</td>
</tr>
<tr>
<td>df.iloc[0,:]</td>
<td>返回第⼀⾏</td>
</tr>
<tr>
<td>df.iloc[0,0]</td>
<td>返回第⼀列的第⼀个元素</td>
</tr>
<tr>
<td>df.loc[0,:]</td>
<td>返回第⼀⾏（索引为默认的数字时，⽤法同df.iloc），但需要注意的是loc是按索引,iloc参数只接受数字参数</td>
</tr>
<tr>
<td>df.ix[[:5],[&ldquo;col1&rdquo;,&ldquo;col2&rdquo;]]</td>
<td>返回字段为col1和col2的前5条数据，可以理解为loc和iloc的结合体。</td>
</tr>
<tr>
<td>df.at[5,&ldquo;col1&rdquo;]</td>
<td>选择索引名称为5，字段名称为col1的数据</td>
</tr>
<tr>
<td>df.iat[5,0]</td>
<td>选择索引排序为5，字段排序为0的数据</td>
</tr>
</tbody>
</table>
<h3 id="23-数据处理">2.3 数据处理</h3>
<table>
<thead>
<tr>
<th>函数</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td>df.columns=[&lsquo;a&rsquo;,&lsquo;b&rsquo;,&lsquo;c&rsquo;]</td>
<td>重命名列名（需要将所有列名列出，否则会报错）</td>
</tr>
<tr>
<td>pd.isnull()</td>
<td>检查DataFrame对象中的空值，并返回⼀个Boolean数组</td>
</tr>
<tr>
<td>pd.notnull()</td>
<td>检查DataFrame对象中的⾮空值，并返回⼀个Boolean数组</td>
</tr>
<tr>
<td>df.dropna()</td>
<td>删除所有包含空值的⾏</td>
</tr>
<tr>
<td>df.dropna(axis=1)</td>
<td>删除所有包含空值的列</td>
</tr>
<tr>
<td>df.dropna(axis=1,thresh=n)</td>
<td>删除所有⼩于n个⾮空值的⾏</td>
</tr>
<tr>
<td>df.fillna(value=x)</td>
<td>⽤x替换DataFrame对象中所有的空值，⽀持df[column_name].fillna(x)</td>
</tr>
<tr>
<td>s.astype(float)</td>
<td>将Series中的数据类型更改为float类型</td>
</tr>
<tr>
<td>s.replace(1,&lsquo;one&rsquo;)</td>
<td>⽤‘one’代替所有等于1的值</td>
</tr>
<tr>
<td>s.replace([1,3],[&lsquo;one&rsquo;,&rsquo;three&rsquo;])</td>
<td>⽤&rsquo;one&rsquo;代替1，⽤&rsquo;three&rsquo;代替3</td>
</tr>
<tr>
<td>df.rename(columns=lambdax:x+1)</td>
<td>批量更改列名</td>
</tr>
<tr>
<td>df.rename(columns={&lsquo;old_name&rsquo;:&rsquo;new_ name&rsquo;})</td>
<td>选择性更改列名</td>
</tr>
<tr>
<td>df.set_index(&lsquo;column_one&rsquo;)</td>
<td>将某个字段设为索引，可接受列表参数，即设置多个索引</td>
</tr>
<tr>
<td>df.reset_index(&ldquo;col1&rdquo;)</td>
<td>将索引设置为col1字段，并将索引新设置为0,1,2&hellip;</td>
</tr>
<tr>
<td>df.rename(index=lambdax:x+1)</td>
<td>批量重命名索引</td>
</tr>
</tbody>
</table>
<h3 id="24-分组排序透视">2.4 分组、排序、透视</h3>
<table>
<thead>
<tr>
<th>函数</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td>df.sort_index().loc[:5]</td>
<td>对前5条数据进⾏索引排序</td>
</tr>
<tr>
<td>df.sort_values(col1)</td>
<td>按照列col1排序数据，默认升序排列</td>
</tr>
<tr>
<td>df.sort_values(col2,ascending=False)</td>
<td>按照列col1降序排列数据</td>
</tr>
<tr>
<td>df.sort_values([col1,col2],ascending=[True,False])</td>
<td>先按列col1升序排列，后按col2降序排列数据</td>
</tr>
<tr>
<td>df.groupby(col)</td>
<td>返回⼀个按列col进⾏分组的Groupby对象</td>
</tr>
<tr>
<td>df.groupby([col1,col2])</td>
<td>返回⼀个按多列进⾏分组的Groupby对象</td>
</tr>
<tr>
<td>df.groupby(col1)[col2].agg(mean)</td>
<td>返回按列col1进⾏分组后，列col2的均值,agg可以接受列表参数，agg([len,np.mean])</td>
</tr>
<tr>
<td>df.pivot_table(index=col1,values=[col2,col3],aggfunc={col2:max,col3:[ma,min]})</td>
<td>创建⼀个按列col1进⾏分组，计算col2的最⼤值和col3的最⼤值、最⼩值的数据透视表</td>
</tr>
<tr>
<td>df.groupby(col1).agg(np.mean)</td>
<td>返回按列col1分组的所有列的均值,⽀持df.groupby(col1).col2.agg([&lsquo;min&rsquo;,&lsquo;max&rsquo;])</td>
</tr>
<tr>
<td>data.apply(np.mean)</td>
<td>对DataFrame中的每⼀列应⽤函数np.mean</td>
</tr>
<tr>
<td>data.apply(np.max,axis=1)</td>
<td>对DataFrame中的每⼀⾏应⽤函数np.max</td>
</tr>
<tr>
<td>df.groupby(col1).col2.transform(&ldquo;sum&rdquo;)</td>
<td>通常与groupby连⽤，避免索引更改</td>
</tr>
</tbody>
</table>
<h3 id="25-数据合并">2.5 数据合并</h3>
<table>
<thead>
<tr>
<th>函数</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td>df1.append(df2)</td>
<td>将df2中的⾏添加到df1的尾部</td>
</tr>
<tr>
<td>df.concat([df1,df2],axis=1,join=&lsquo;inner&rsquo;)</td>
<td>将df2中的列添加到df1的尾部,值为空的对应⾏与对应列都不要</td>
</tr>
<tr>
<td>df1.join(df2.set_index(col1),on=col1,how=&lsquo;inner&rsquo;)</td>
<td>对df1的列和df2的列执⾏SQL形式的join，默认按照索引来进⾏合并，如果df1和df2有共同字段时，会报错，可通过设置lsuffix,rsuffix来进⾏解决，如果需要按照共同列进⾏合并，就要⽤到set_index(col1)</td>
</tr>
<tr>
<td>pd.merge(df1,df2,on=&lsquo;col1&rsquo;,how=&lsquo;outer&rsquo;)</td>
<td>对df1和df2合并，按照col1，⽅式为outer</td>
</tr>
<tr>
<td>pd.merge(df1,df2,left_index=True,right_index=True,how=&lsquo;outer&rsquo;)</td>
<td>与 df1.join(df2, how=&lsquo;outer&rsquo;)效果相同</td>
</tr>
</tbody>
</table>
<h3 id="26-数据导出">2.6 数据导出</h3>
<table>
<thead>
<tr>
<th>函数</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td>df.to_csv(filename)</td>
<td>导出数据到CSV⽂件</td>
</tr>
<tr>
<td>df.to_excel(filename)</td>
<td>导出数据到Excel⽂件</td>
</tr>
<tr>
<td>df.to_sql(table_name,connection_object)</td>
<td>导出数据到SQL表</td>
</tr>
<tr>
<td>df.to_json(filename)</td>
<td>以Json格式导出数据到⽂本⽂件</td>
</tr>
<tr>
<td>writer=pd.ExcelWriter(&rsquo;test.xlsx&rsquo;,index=False)</td>
<td>写入excel</td>
</tr>
<tr>
<td>df1.to_excel(writer,sheet_name=&lsquo;单位&rsquo;)和writer.save()</td>
<td>将多个数据帧写⼊同⼀个⼯作簿的多个sheet(⼯作表)</td>
</tr>
</tbody>
</table>
<h3 id="27-查看数据">2.7 查看数据</h3>
<table>
<thead>
<tr>
<th>函数</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td>df.head(n)</td>
<td>查看DataFrame对象的前n⾏</td>
</tr>
<tr>
<td>df.tail(n)</td>
<td>查看DataFrame对象的最后n⾏</td>
</tr>
<tr>
<td>df.shape()</td>
<td>查看⾏数和列数</td>
</tr>
<tr>
<td>df.info()</td>
<td>查看索引、数据类型和内存信息</td>
</tr>
<tr>
<td>df.columns()</td>
<td>查看字段（⾸⾏）名称</td>
</tr>
<tr>
<td>df.describe()</td>
<td>查看数值型列的汇总统计</td>
</tr>
<tr>
<td>s.value_counts(dropna=False)</td>
<td>查看Series对象的唯⼀值和计数</td>
</tr>
<tr>
<td>df.apply(pd.Series.value_counts)</td>
<td>查看DataFrame对象中每⼀列的唯⼀值和计数</td>
</tr>
<tr>
<td>df.isnull().any()</td>
<td>查看是否有缺失值</td>
</tr>
<tr>
<td>df[df[column_name].duplicated()]</td>
<td>查看column_name字段数据重复的数据信息</td>
</tr>
<tr>
<td>df[df[column_name].duplicated()].count()</td>
<td>查看column_name字段数据重复的个数</td>
</tr>
</tbody>
</table>
<h2 id="3matplotlib生成统计图">3、matplotlib生成统计图</h2>
<p>只是简单介绍常见用法和参数<br>
架构图

        <img class="mx-auto" alt="" src="/posts/matplotlib/anatomy.png" />   
    </p>
<p>中文架构图

        <img class="mx-auto" alt="" src="/posts/matplotlib/anatomy_zh.png" />   
    </p>
<p>其他详细用法请参考官方手册: <a href="https://matplotlib.org/stable/tutorials/index.html">https://matplotlib.org/stable/tutorials/index.html</a></p>
<p>下面示例的源码参考github: <a href="https://github.com.anTtutu/anttu.code.learn.python.git">https://github.com.anTtutu/anttu.code.learn.python.git</a></p>
<h3 id="31-折线图">3.1 折线图</h3>
<table>
<thead>
<tr>
<th>说明</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td>适用场景</td>
<td>折线图适合二维的大数据集，还适合多个二维数据集的比较。一般用来表示趋势的变化，横轴一般为日期字段。</td>
</tr>
<tr>
<td>优势</td>
<td>容易反应出数据变化的趋势。</td>
</tr>
</tbody>
</table>
<h4 id="示例">示例：</h4>
<div class="highlight"><div style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">
<table style="border-spacing:0;padding:0;margin:0;border:0;"><tr><td style="vertical-align:top;padding:0;margin:0;border:0;">
<pre tabindex="0" style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">1
</span></code></pre></td>
<td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
<pre tabindex="0" style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-python" data-lang="python"><span style="display:flex;"><span>plt<span style="color:#000;font-weight:bold">.</span>plot(x_data, y_data, <span style="color:#d14">&#39;*-&#39;</span>, label<span style="color:#000;font-weight:bold">=</span><span style="color:#d14">u</span><span style="color:#d14">&#39;请求攻击统计&#39;</span>, linewidth<span style="color:#000;font-weight:bold">=</span><span style="color:#099">1</span>)
</span></span></code></pre></td></tr></table>
</div>
</div><h4 id="demo">demo:</h4>
<div class="highlight"><div style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">
<table style="border-spacing:0;padding:0;margin:0;border:0;"><tr><td style="vertical-align:top;padding:0;margin:0;border:0;">
<pre tabindex="0" style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 1
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 2
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 3
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 4
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 5
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 6
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 7
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 8
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 9
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">10
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">11
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">12
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">13
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">14
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">15
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">16
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">17
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">18
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">19
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">20
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">21
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">22
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">23
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">24
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">25
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">26
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">27
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">28
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">29
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">30
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">31
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">32
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">33
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">34
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">35
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">36
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">37
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">38
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">39
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">40
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">41
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">42
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">43
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">44
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">45
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">46
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">47
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">48
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">49
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">50
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">51
</span></code></pre></td>
<td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
<pre tabindex="0" style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-python" data-lang="python"><span style="display:flex;"><span><span style="color:#998;font-style:italic"># -*- coding:utf-8 -*-</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">import</span> <span style="color:#555">pandas</span> <span style="color:#000;font-weight:bold">as</span> <span style="color:#555">pd</span>
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">import</span> <span style="color:#555">matplotlib.pyplot</span> <span style="color:#000;font-weight:bold">as</span> <span style="color:#555">plt</span>
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">import</span> <span style="color:#555">os</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>plt<span style="color:#000;font-weight:bold">.</span>rcParams[<span style="color:#d14">&#39;font.sans-serif&#39;</span>] <span style="color:#000;font-weight:bold">=</span> [<span style="color:#d14">&#39;SimHei&#39;</span>]
</span></span><span style="display:flex;"><span>plt<span style="color:#000;font-weight:bold">.</span>rcParams[<span style="color:#d14">&#39;font.family&#39;</span>] <span style="color:#000;font-weight:bold">=</span> <span style="color:#d14">&#39;sans-serif&#39;</span>
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># 解决负号&#39;-&#39;显示为方块的问题</span>
</span></span><span style="display:flex;"><span>plt<span style="color:#000;font-weight:bold">.</span>rcParams[<span style="color:#d14">&#39;axes.unicode_minus&#39;</span>] <span style="color:#000;font-weight:bold">=</span> <span style="color:#000;font-weight:bold">False</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># 相对路径</span>
</span></span><span style="display:flex;"><span>project_dir <span style="color:#000;font-weight:bold">=</span> os<span style="color:#000;font-weight:bold">.</span>path<span style="color:#000;font-weight:bold">.</span>abspath(<span style="color:#d14">&#39;.&#39;</span>)
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>path <span style="color:#000;font-weight:bold">=</span> project_dir <span style="color:#000;font-weight:bold">+</span> <span style="color:#d14">&#34;</span><span style="color:#d14">\\</span><span style="color:#d14">request.csv&#34;</span>
</span></span><span style="display:flex;"><span>out_path <span style="color:#000;font-weight:bold">=</span> project_dir <span style="color:#000;font-weight:bold">+</span> <span style="color:#d14">&#34;</span><span style="color:#d14">\\</span><span style="color:#d14">request_line.jpg&#34;</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># 全路径</span>
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># path = &#34;D:\\request.csv&#34;</span>
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># out_path = &#34;D:\\request.jpg&#34;</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">def</span> <span style="color:#900;font-weight:bold">main</span>():
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># 使用python下pandas库读取csv文件</span>
</span></span><span style="display:flex;"><span>    data <span style="color:#000;font-weight:bold">=</span> pd<span style="color:#000;font-weight:bold">.</span>read_csv(path, encoding<span style="color:#000;font-weight:bold">=</span><span style="color:#d14">&#39;gbk&#39;</span>)
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># 读取列名为距离误差和时间点的所有行数据</span>
</span></span><span style="display:flex;"><span>    y_data <span style="color:#000;font-weight:bold">=</span> data<span style="color:#000;font-weight:bold">.</span>loc[:, <span style="color:#d14">&#39;error_count&#39;</span>]
</span></span><span style="display:flex;"><span>    x_data <span style="color:#000;font-weight:bold">=</span> data<span style="color:#000;font-weight:bold">.</span>loc[:, <span style="color:#d14">&#39;error_request_url&#39;</span>]
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># 设置画布</span>
</span></span><span style="display:flex;"><span>    plt<span style="color:#000;font-weight:bold">.</span>figure(num<span style="color:#000;font-weight:bold">=</span><span style="color:#099">1</span>, dpi<span style="color:#000;font-weight:bold">=</span><span style="color:#099">100</span>, figsize<span style="color:#000;font-weight:bold">=</span>(<span style="color:#099">24</span>, <span style="color:#099">32</span>))
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># 点线图</span>
</span></span><span style="display:flex;"><span>    plt<span style="color:#000;font-weight:bold">.</span>plot(x_data, y_data, <span style="color:#d14">&#39;*-&#39;</span>, label<span style="color:#000;font-weight:bold">=</span><span style="color:#d14">u</span><span style="color:#d14">&#39;请求攻击统计&#39;</span>, linewidth<span style="color:#000;font-weight:bold">=</span><span style="color:#099">1</span>)
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># 为了让x轴的内容适配展示的长度，请求路径字段比较长，有几十个字符</span>
</span></span><span style="display:flex;"><span>    plt<span style="color:#000;font-weight:bold">.</span>xticks(rotation<span style="color:#000;font-weight:bold">=</span><span style="color:#099">270</span>)
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># 统计图的标题</span>
</span></span><span style="display:flex;"><span>    plt<span style="color:#000;font-weight:bold">.</span>title(<span style="color:#d14">u</span><span style="color:#d14">&#34;请求攻击统计&#34;</span>, size<span style="color:#000;font-weight:bold">=</span><span style="color:#099">20</span>)
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># 显示图例</span>
</span></span><span style="display:flex;"><span>    plt<span style="color:#000;font-weight:bold">.</span>legend()
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># X坐标-横坐标标题</span>
</span></span><span style="display:flex;"><span>    plt<span style="color:#000;font-weight:bold">.</span>xlabel(<span style="color:#d14">u</span><span style="color:#d14">&#39;请求名称&#39;</span>, size<span style="color:#000;font-weight:bold">=</span><span style="color:#099">14</span>)
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># Y坐标-纵坐标标题</span>
</span></span><span style="display:flex;"><span>    plt<span style="color:#000;font-weight:bold">.</span>ylabel(<span style="color:#d14">u</span><span style="color:#d14">&#39;请求次数&#39;</span>, size<span style="color:#000;font-weight:bold">=</span><span style="color:#099">14</span>)
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># 在展示图片前可以将画出的曲线保存到自己路径下的文件夹中</span>
</span></span><span style="display:flex;"><span>    plt<span style="color:#000;font-weight:bold">.</span>savefig(out_path)
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># 显示图像</span>
</span></span><span style="display:flex;"><span>    plt<span style="color:#000;font-weight:bold">.</span>show()
</span></span><span style="display:flex;"><span>    <span style="color:#0086b3">print</span>(<span style="color:#d14">&#34;all picture is starting&#34;</span>)
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">if</span> __name__ <span style="color:#000;font-weight:bold">==</span> <span style="color:#d14">&#34;__main__&#34;</span>:
</span></span><span style="display:flex;"><span>    main()
</span></span></code></pre></td></tr></table>
</div>
</div><h3 id="32-柱状图">3.2 柱状图</h3>
<table>
<thead>
<tr>
<th>说明</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td>适用场景</td>
<td>适用场合是二维数据集（每个数据点包括两个值x和y），但只有一个维度需要比较，用于显示一段时间内的数据变化或显示各项之间的比较情况。适用于枚举的数据，比如地域之间的关系，数据没有必然的连续性。</td>
</tr>
<tr>
<td>优势</td>
<td>柱状图利用柱子的高度，反映数据的差异，肉眼对高度差异很敏感。</td>
</tr>
<tr>
<td>劣势</td>
<td>柱状图的局限在于只适用中小规模的数据集。</td>
</tr>
</tbody>
</table>
<h4 id="示例-1">示例：</h4>
<div class="highlight"><div style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">
<table style="border-spacing:0;padding:0;margin:0;border:0;"><tr><td style="vertical-align:top;padding:0;margin:0;border:0;">
<pre tabindex="0" style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">1
</span></code></pre></td>
<td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
<pre tabindex="0" style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-python" data-lang="python"><span style="display:flex;"><span>plt<span style="color:#000;font-weight:bold">.</span>bar(np<span style="color:#000;font-weight:bold">.</span>arange(<span style="color:#0086b3">len</span>(name_list)), height_list, label<span style="color:#000;font-weight:bold">=</span><span style="color:#d14">u</span><span style="color:#d14">&#39;请求攻击统计&#39;</span>, tick_label<span style="color:#000;font-weight:bold">=</span>name_list, fc<span style="color:#000;font-weight:bold">=</span><span style="color:#d14">&#39;r&#39;</span>)
</span></span></code></pre></td></tr></table>
</div>
</div><h4 id="demo-1">demo:</h4>
<div class="highlight"><div style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">
<table style="border-spacing:0;padding:0;margin:0;border:0;"><tr><td style="vertical-align:top;padding:0;margin:0;border:0;">
<pre tabindex="0" style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 1
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 2
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 3
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 4
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 5
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 6
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 7
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 8
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 9
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">10
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">11
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">12
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">13
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">14
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">15
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">16
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">17
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">18
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">19
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">20
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">21
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">22
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">23
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">24
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">25
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">26
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">27
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">28
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">29
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">30
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">31
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">32
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">33
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">34
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">35
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">36
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">37
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">38
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">39
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">40
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">41
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">42
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">43
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">44
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">45
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">46
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">47
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">48
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">49
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">50
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">51
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">52
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">53
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">54
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">55
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">56
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">57
</span></code></pre></td>
<td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
<pre tabindex="0" style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-python" data-lang="python"><span style="display:flex;"><span><span style="color:#998;font-style:italic"># -*- coding:utf-8 -*-</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">import</span> <span style="color:#555">pandas</span> <span style="color:#000;font-weight:bold">as</span> <span style="color:#555">pd</span>
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">import</span> <span style="color:#555">matplotlib.pyplot</span> <span style="color:#000;font-weight:bold">as</span> <span style="color:#555">plt</span>
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">import</span> <span style="color:#555">numpy</span> <span style="color:#000;font-weight:bold">as</span> <span style="color:#555">np</span>
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">import</span> <span style="color:#555">os</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>plt<span style="color:#000;font-weight:bold">.</span>rcParams[<span style="color:#d14">&#39;font.sans-serif&#39;</span>] <span style="color:#000;font-weight:bold">=</span> [<span style="color:#d14">&#39;SimHei&#39;</span>]
</span></span><span style="display:flex;"><span>plt<span style="color:#000;font-weight:bold">.</span>rcParams[<span style="color:#d14">&#39;font.family&#39;</span>] <span style="color:#000;font-weight:bold">=</span> <span style="color:#d14">&#39;sans-serif&#39;</span>
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># 解决负号&#39;-&#39;显示为方块的问题</span>
</span></span><span style="display:flex;"><span>plt<span style="color:#000;font-weight:bold">.</span>rcParams[<span style="color:#d14">&#39;axes.unicode_minus&#39;</span>] <span style="color:#000;font-weight:bold">=</span> <span style="color:#000;font-weight:bold">False</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># 相对路径</span>
</span></span><span style="display:flex;"><span>project_dir <span style="color:#000;font-weight:bold">=</span> os<span style="color:#000;font-weight:bold">.</span>path<span style="color:#000;font-weight:bold">.</span>abspath(<span style="color:#d14">&#39;.&#39;</span>)
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>path <span style="color:#000;font-weight:bold">=</span> project_dir <span style="color:#000;font-weight:bold">+</span> <span style="color:#d14">&#34;</span><span style="color:#d14">\\</span><span style="color:#d14">request.csv&#34;</span>
</span></span><span style="display:flex;"><span>out_path <span style="color:#000;font-weight:bold">=</span> project_dir <span style="color:#000;font-weight:bold">+</span> <span style="color:#d14">&#34;</span><span style="color:#d14">\\</span><span style="color:#d14">request_bar.jpg&#34;</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># 全路径</span>
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># path = &#34;D:\\request.csv&#34;</span>
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># out_path = &#34;D:\\request.jpg&#34;</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">def</span> <span style="color:#900;font-weight:bold">main</span>():
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># 使用python下pandas库读取csv文件</span>
</span></span><span style="display:flex;"><span>    data <span style="color:#000;font-weight:bold">=</span> pd<span style="color:#000;font-weight:bold">.</span>read_csv(path, encoding<span style="color:#000;font-weight:bold">=</span><span style="color:#d14">&#39;gbk&#39;</span>)
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># 读取列名为距离误差和时间点的所有行数据</span>
</span></span><span style="display:flex;"><span>    height_list <span style="color:#000;font-weight:bold">=</span> data<span style="color:#000;font-weight:bold">.</span>loc[:, <span style="color:#d14">&#39;error_count&#39;</span>]
</span></span><span style="display:flex;"><span>    name_list <span style="color:#000;font-weight:bold">=</span> data<span style="color:#000;font-weight:bold">.</span>loc[:, <span style="color:#d14">&#39;error_request_url&#39;</span>]
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># 设置画布</span>
</span></span><span style="display:flex;"><span>    plt<span style="color:#000;font-weight:bold">.</span>figure(num<span style="color:#000;font-weight:bold">=</span><span style="color:#099">1</span>, dpi<span style="color:#000;font-weight:bold">=</span><span style="color:#099">100</span>, figsize<span style="color:#000;font-weight:bold">=</span>(<span style="color:#099">24</span>, <span style="color:#099">32</span>))
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># 柱状图</span>
</span></span><span style="display:flex;"><span>    plt<span style="color:#000;font-weight:bold">.</span>bar(np<span style="color:#000;font-weight:bold">.</span>arange(<span style="color:#0086b3">len</span>(name_list)), height_list, label<span style="color:#000;font-weight:bold">=</span><span style="color:#d14">u</span><span style="color:#d14">&#39;请求攻击统计&#39;</span>, tick_label<span style="color:#000;font-weight:bold">=</span>name_list, fc<span style="color:#000;font-weight:bold">=</span><span style="color:#d14">&#39;r&#39;</span>)
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># 添加数据标签，也就是给柱子顶部添加标签</span>
</span></span><span style="display:flex;"><span>    x <span style="color:#000;font-weight:bold">=</span> np<span style="color:#000;font-weight:bold">.</span>arange(<span style="color:#0086b3">len</span>(height_list))
</span></span><span style="display:flex;"><span>    y <span style="color:#000;font-weight:bold">=</span> np<span style="color:#000;font-weight:bold">.</span>array(<span style="color:#0086b3">list</span>(height_list<span style="color:#000;font-weight:bold">.</span>values))
</span></span><span style="display:flex;"><span>    <span style="color:#000;font-weight:bold">for</span> a, b <span style="color:#000;font-weight:bold">in</span> <span style="color:#0086b3">zip</span>(x, y):
</span></span><span style="display:flex;"><span>        plt<span style="color:#000;font-weight:bold">.</span>text(a, b <span style="color:#000;font-weight:bold">+</span> <span style="color:#099">0.05</span>, <span style="color:#d14">&#39;</span><span style="color:#d14">%.0f</span><span style="color:#d14">&#39;</span> <span style="color:#000;font-weight:bold">%</span> b, ha<span style="color:#000;font-weight:bold">=</span><span style="color:#d14">&#39;center&#39;</span>, va<span style="color:#000;font-weight:bold">=</span><span style="color:#d14">&#39;bottom&#39;</span>, fontsize<span style="color:#000;font-weight:bold">=</span><span style="color:#099">10</span>)
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># 为了让x轴的内容适配展示的长度，请求路径字段比较长，有几十个字符</span>
</span></span><span style="display:flex;"><span>    plt<span style="color:#000;font-weight:bold">.</span>xticks(rotation<span style="color:#000;font-weight:bold">=</span><span style="color:#099">270</span>)
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># 统计图的标题</span>
</span></span><span style="display:flex;"><span>    plt<span style="color:#000;font-weight:bold">.</span>title(<span style="color:#d14">u</span><span style="color:#d14">&#34;请求攻击统计&#34;</span>, size<span style="color:#000;font-weight:bold">=</span><span style="color:#099">20</span>)
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># 显示图例</span>
</span></span><span style="display:flex;"><span>    plt<span style="color:#000;font-weight:bold">.</span>legend()
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># X坐标-横坐标标题</span>
</span></span><span style="display:flex;"><span>    plt<span style="color:#000;font-weight:bold">.</span>xlabel(<span style="color:#d14">u</span><span style="color:#d14">&#39;请求名称&#39;</span>, size<span style="color:#000;font-weight:bold">=</span><span style="color:#099">14</span>)
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># Y坐标-纵坐标标题</span>
</span></span><span style="display:flex;"><span>    plt<span style="color:#000;font-weight:bold">.</span>ylabel(<span style="color:#d14">u</span><span style="color:#d14">&#39;请求次数&#39;</span>, size<span style="color:#000;font-weight:bold">=</span><span style="color:#099">14</span>)
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># 在展示图片前可以将画出的曲线保存到自己路径下的文件夹中</span>
</span></span><span style="display:flex;"><span>    plt<span style="color:#000;font-weight:bold">.</span>savefig(out_path)
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># 显示图像</span>
</span></span><span style="display:flex;"><span>    plt<span style="color:#000;font-weight:bold">.</span>show()
</span></span><span style="display:flex;"><span>    <span style="color:#0086b3">print</span>(<span style="color:#d14">&#34;all picture is starting&#34;</span>)
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">if</span> __name__ <span style="color:#000;font-weight:bold">==</span> <span style="color:#d14">&#34;__main__&#34;</span>:
</span></span><span style="display:flex;"><span>    main()
</span></span></code></pre></td></tr></table>
</div>
</div><h3 id="33-堆积柱状图">3.3 堆积柱状图</h3>
<table>
<thead>
<tr>
<th>说明</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td>适用场景</td>
<td>显示各个项目之间的比较情况，和柱状图类似的作用。不仅可以直观的看出每个系列的值，还能够反映出系列的总和，尤其是当需要看某一单位的综合以及各系列值的比重时，最适合。</td>
</tr>
<tr>
<td>优势</td>
<td>每个条都清晰表示数据，直观。</td>
</tr>
</tbody>
</table>
<h4 id="demo-2">demo：</h4>
<div class="highlight"><div style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">
<table style="border-spacing:0;padding:0;margin:0;border:0;"><tr><td style="vertical-align:top;padding:0;margin:0;border:0;">
<pre tabindex="0" style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">  1
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">  2
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">  3
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">  4
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">  5
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">  6
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">  7
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">  8
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">  9
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 10
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 11
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 12
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 13
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 14
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 15
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 16
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 17
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 18
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 19
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 20
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 21
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 22
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 23
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 24
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 25
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 26
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 27
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 28
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 29
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 30
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 31
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 32
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 33
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 34
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 35
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 36
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 37
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 38
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 39
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 40
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 41
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 42
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 43
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 44
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 45
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 46
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 47
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 48
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 49
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 50
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 51
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 52
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 53
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 54
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 55
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 56
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 57
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 58
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 59
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 60
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 61
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 62
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 63
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 64
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 65
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 66
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 67
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 68
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 69
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 70
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 71
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 72
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 73
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 74
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 75
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 76
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 77
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 78
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 79
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 80
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 81
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 82
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 83
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 84
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 85
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 86
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 87
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 88
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 89
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 90
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 91
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 92
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 93
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 94
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 95
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 96
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 97
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 98
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 99
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">100
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">101
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">102
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">103
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">104
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">105
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">106
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">107
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">108
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">109
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">110
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">111
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">112
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">113
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">114
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">115
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">116
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">117
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">118
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">119
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">120
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">121
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">122
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">123
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">124
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">125
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">126
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">127
</span></code></pre></td>
<td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
<pre tabindex="0" style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-python" data-lang="python"><span style="display:flex;"><span><span style="color:#998;font-style:italic"># -*- coding:utf-8 -*-</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">import</span> <span style="color:#555">pandas</span> <span style="color:#000;font-weight:bold">as</span> <span style="color:#555">pd</span>
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">import</span> <span style="color:#555">matplotlib.pyplot</span> <span style="color:#000;font-weight:bold">as</span> <span style="color:#555">plt</span>
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">import</span> <span style="color:#555">numpy</span> <span style="color:#000;font-weight:bold">as</span> <span style="color:#555">np</span>
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">import</span> <span style="color:#555">os</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>plt<span style="color:#000;font-weight:bold">.</span>rcParams[<span style="color:#d14">&#39;font.sans-serif&#39;</span>] <span style="color:#000;font-weight:bold">=</span> [<span style="color:#d14">&#39;SimHei&#39;</span>]
</span></span><span style="display:flex;"><span>plt<span style="color:#000;font-weight:bold">.</span>rcParams[<span style="color:#d14">&#39;font.family&#39;</span>] <span style="color:#000;font-weight:bold">=</span> <span style="color:#d14">&#39;sans-serif&#39;</span>
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># 解决负号&#39;-&#39;显示为方块的问题</span>
</span></span><span style="display:flex;"><span>plt<span style="color:#000;font-weight:bold">.</span>rcParams[<span style="color:#d14">&#39;axes.unicode_minus&#39;</span>] <span style="color:#000;font-weight:bold">=</span> <span style="color:#000;font-weight:bold">False</span>
</span></span><span style="display:flex;"><span>plt<span style="color:#000;font-weight:bold">.</span>rcParams[<span style="color:#d14">&#39;axes.labelsize&#39;</span>] <span style="color:#000;font-weight:bold">=</span> <span style="color:#099">32</span>
</span></span><span style="display:flex;"><span>plt<span style="color:#000;font-weight:bold">.</span>rcParams[<span style="color:#d14">&#39;xtick.labelsize&#39;</span>] <span style="color:#000;font-weight:bold">=</span> <span style="color:#099">24</span>
</span></span><span style="display:flex;"><span>plt<span style="color:#000;font-weight:bold">.</span>rcParams[<span style="color:#d14">&#39;ytick.labelsize&#39;</span>] <span style="color:#000;font-weight:bold">=</span> <span style="color:#099">24</span>
</span></span><span style="display:flex;"><span>plt<span style="color:#000;font-weight:bold">.</span>rcParams[<span style="color:#d14">&#39;legend.fontsize&#39;</span>] <span style="color:#000;font-weight:bold">=</span> <span style="color:#099">20</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># 相对路径</span>
</span></span><span style="display:flex;"><span>project_dir <span style="color:#000;font-weight:bold">=</span> os<span style="color:#000;font-weight:bold">.</span>path<span style="color:#000;font-weight:bold">.</span>abspath(<span style="color:#d14">&#39;.&#39;</span>)
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>path <span style="color:#000;font-weight:bold">=</span> project_dir <span style="color:#000;font-weight:bold">+</span> <span style="color:#d14">&#34;</span><span style="color:#d14">\\</span><span style="color:#d14">stack.csv&#34;</span>
</span></span><span style="display:flex;"><span>out_path <span style="color:#000;font-weight:bold">=</span> project_dir <span style="color:#000;font-weight:bold">+</span> <span style="color:#d14">&#34;</span><span style="color:#d14">\\</span><span style="color:#d14">request_stack_bar.jpg&#34;</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># 全路径</span>
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># path = &#34;D:\\request.csv&#34;</span>
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># out_path = &#34;D:\\request.jpg&#34;</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">def</span> <span style="color:#900;font-weight:bold">main</span>():
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># 使用python下pandas库读取csv文件</span>
</span></span><span style="display:flex;"><span>    data <span style="color:#000;font-weight:bold">=</span> pd<span style="color:#000;font-weight:bold">.</span>read_csv(path, encoding<span style="color:#000;font-weight:bold">=</span><span style="color:#d14">&#39;utf-8&#39;</span>)
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># 读取列名为距离误差和时间点的所有行数据</span>
</span></span><span style="display:flex;"><span>    name_list <span style="color:#000;font-weight:bold">=</span> data<span style="color:#000;font-weight:bold">.</span>loc[:, <span style="color:#d14">&#39;姓名&#39;</span>]
</span></span><span style="display:flex;"><span>    january_list <span style="color:#000;font-weight:bold">=</span> data<span style="color:#000;font-weight:bold">.</span>loc[:, <span style="color:#d14">&#39;一月&#39;</span>]
</span></span><span style="display:flex;"><span>    february_list <span style="color:#000;font-weight:bold">=</span> data<span style="color:#000;font-weight:bold">.</span>loc[:, <span style="color:#d14">&#39;二月&#39;</span>]
</span></span><span style="display:flex;"><span>    march_list <span style="color:#000;font-weight:bold">=</span> data<span style="color:#000;font-weight:bold">.</span>loc[:, <span style="color:#d14">&#39;三月&#39;</span>]
</span></span><span style="display:flex;"><span>    april_list <span style="color:#000;font-weight:bold">=</span> data<span style="color:#000;font-weight:bold">.</span>loc[:, <span style="color:#d14">&#39;四月&#39;</span>]
</span></span><span style="display:flex;"><span>    may_list <span style="color:#000;font-weight:bold">=</span> data<span style="color:#000;font-weight:bold">.</span>loc[:, <span style="color:#d14">&#39;五月&#39;</span>]
</span></span><span style="display:flex;"><span>    june_list <span style="color:#000;font-weight:bold">=</span> data<span style="color:#000;font-weight:bold">.</span>loc[:, <span style="color:#d14">&#39;六月&#39;</span>]
</span></span><span style="display:flex;"><span>    july_list <span style="color:#000;font-weight:bold">=</span> data<span style="color:#000;font-weight:bold">.</span>loc[:, <span style="color:#d14">&#39;七月&#39;</span>]
</span></span><span style="display:flex;"><span>    august_list <span style="color:#000;font-weight:bold">=</span> data<span style="color:#000;font-weight:bold">.</span>loc[:, <span style="color:#d14">&#39;八月&#39;</span>]
</span></span><span style="display:flex;"><span>    september_list <span style="color:#000;font-weight:bold">=</span> data<span style="color:#000;font-weight:bold">.</span>loc[:, <span style="color:#d14">&#39;九月&#39;</span>]
</span></span><span style="display:flex;"><span>    october_list <span style="color:#000;font-weight:bold">=</span> data<span style="color:#000;font-weight:bold">.</span>loc[:, <span style="color:#d14">&#39;十月&#39;</span>]
</span></span><span style="display:flex;"><span>    november_list <span style="color:#000;font-weight:bold">=</span> data<span style="color:#000;font-weight:bold">.</span>loc[:, <span style="color:#d14">&#39;十一月&#39;</span>]
</span></span><span style="display:flex;"><span>    december_list <span style="color:#000;font-weight:bold">=</span> data<span style="color:#000;font-weight:bold">.</span>loc[:, <span style="color:#d14">&#39;十二月&#39;</span>]
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># 设置画布</span>
</span></span><span style="display:flex;"><span>    plt<span style="color:#000;font-weight:bold">.</span>figure(num<span style="color:#000;font-weight:bold">=</span><span style="color:#099">1</span>, dpi<span style="color:#000;font-weight:bold">=</span><span style="color:#099">100</span>, figsize<span style="color:#000;font-weight:bold">=</span>(<span style="color:#099">24</span>, <span style="color:#099">32</span>))
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># 柱状图</span>
</span></span><span style="display:flex;"><span>    plt<span style="color:#000;font-weight:bold">.</span>bar(np<span style="color:#000;font-weight:bold">.</span>arange(<span style="color:#0086b3">len</span>(name_list)), january_list, label<span style="color:#000;font-weight:bold">=</span><span style="color:#d14">u</span><span style="color:#d14">&#39;1月业绩&#39;</span>, tick_label<span style="color:#000;font-weight:bold">=</span>name_list, fc<span style="color:#000;font-weight:bold">=</span><span style="color:#d14">&#39;r&#39;</span>)
</span></span><span style="display:flex;"><span>    plt<span style="color:#000;font-weight:bold">.</span>bar(np<span style="color:#000;font-weight:bold">.</span>arange(<span style="color:#0086b3">len</span>(name_list)), february_list, label<span style="color:#000;font-weight:bold">=</span><span style="color:#d14">u</span><span style="color:#d14">&#39;2月业绩&#39;</span>, bottom<span style="color:#000;font-weight:bold">=</span>january_list, tick_label<span style="color:#000;font-weight:bold">=</span>name_list, fc<span style="color:#000;font-weight:bold">=</span><span style="color:#d14">&#39;b&#39;</span>)
</span></span><span style="display:flex;"><span>    plt<span style="color:#000;font-weight:bold">.</span>bar(np<span style="color:#000;font-weight:bold">.</span>arange(<span style="color:#0086b3">len</span>(name_list)), march_list, label<span style="color:#000;font-weight:bold">=</span><span style="color:#d14">u</span><span style="color:#d14">&#39;3月业绩&#39;</span>, bottom<span style="color:#000;font-weight:bold">=</span>january_list<span style="color:#000;font-weight:bold">+</span>february_list, tick_label<span style="color:#000;font-weight:bold">=</span>name_list, fc<span style="color:#000;font-weight:bold">=</span><span style="color:#d14">&#39;g&#39;</span>)
</span></span><span style="display:flex;"><span>    plt<span style="color:#000;font-weight:bold">.</span>bar(np<span style="color:#000;font-weight:bold">.</span>arange(<span style="color:#0086b3">len</span>(name_list)), april_list, label<span style="color:#000;font-weight:bold">=</span><span style="color:#d14">u</span><span style="color:#d14">&#39;4月业绩&#39;</span>, bottom<span style="color:#000;font-weight:bold">=</span>january_list<span style="color:#000;font-weight:bold">+</span>february_list<span style="color:#000;font-weight:bold">+</span>march_list, tick_label<span style="color:#000;font-weight:bold">=</span>name_list, fc<span style="color:#000;font-weight:bold">=</span><span style="color:#d14">&#39;c&#39;</span>)
</span></span><span style="display:flex;"><span>    plt<span style="color:#000;font-weight:bold">.</span>bar(np<span style="color:#000;font-weight:bold">.</span>arange(<span style="color:#0086b3">len</span>(name_list)), may_list, label<span style="color:#000;font-weight:bold">=</span><span style="color:#d14">u</span><span style="color:#d14">&#39;5月业绩&#39;</span>, bottom<span style="color:#000;font-weight:bold">=</span>january_list<span style="color:#000;font-weight:bold">+</span>february_list<span style="color:#000;font-weight:bold">+</span>march_list<span style="color:#000;font-weight:bold">+</span>april_list, tick_label<span style="color:#000;font-weight:bold">=</span>name_list, fc<span style="color:#000;font-weight:bold">=</span><span style="color:#d14">&#39;y&#39;</span>)
</span></span><span style="display:flex;"><span>    plt<span style="color:#000;font-weight:bold">.</span>bar(np<span style="color:#000;font-weight:bold">.</span>arange(<span style="color:#0086b3">len</span>(name_list)), june_list, label<span style="color:#000;font-weight:bold">=</span><span style="color:#d14">u</span><span style="color:#d14">&#39;6月业绩&#39;</span>, bottom<span style="color:#000;font-weight:bold">=</span>january_list<span style="color:#000;font-weight:bold">+</span>february_list<span style="color:#000;font-weight:bold">+</span>march_list<span style="color:#000;font-weight:bold">+</span>april_list<span style="color:#000;font-weight:bold">+</span>may_list, tick_label<span style="color:#000;font-weight:bold">=</span>name_list, fc<span style="color:#000;font-weight:bold">=</span><span style="color:#d14">&#39;m&#39;</span>)
</span></span><span style="display:flex;"><span>    plt<span style="color:#000;font-weight:bold">.</span>bar(np<span style="color:#000;font-weight:bold">.</span>arange(<span style="color:#0086b3">len</span>(name_list)), july_list, label<span style="color:#000;font-weight:bold">=</span><span style="color:#d14">u</span><span style="color:#d14">&#39;7月业绩&#39;</span>, bottom<span style="color:#000;font-weight:bold">=</span>january_list<span style="color:#000;font-weight:bold">+</span>february_list<span style="color:#000;font-weight:bold">+</span>march_list<span style="color:#000;font-weight:bold">+</span>april_list<span style="color:#000;font-weight:bold">+</span>may_list<span style="color:#000;font-weight:bold">+</span>june_list, tick_label<span style="color:#000;font-weight:bold">=</span>name_list, fc<span style="color:#000;font-weight:bold">=</span><span style="color:#d14">&#39;WhiteSmoke&#39;</span>)
</span></span><span style="display:flex;"><span>    plt<span style="color:#000;font-weight:bold">.</span>bar(np<span style="color:#000;font-weight:bold">.</span>arange(<span style="color:#0086b3">len</span>(name_list)), august_list, label<span style="color:#000;font-weight:bold">=</span><span style="color:#d14">u</span><span style="color:#d14">&#39;8月业绩&#39;</span>, bottom<span style="color:#000;font-weight:bold">=</span>january_list<span style="color:#000;font-weight:bold">+</span>february_list<span style="color:#000;font-weight:bold">+</span>march_list<span style="color:#000;font-weight:bold">+</span>april_list<span style="color:#000;font-weight:bold">+</span>may_list<span style="color:#000;font-weight:bold">+</span>june_list<span style="color:#000;font-weight:bold">+</span>july_list, tick_label<span style="color:#000;font-weight:bold">=</span>name_list, fc<span style="color:#000;font-weight:bold">=</span><span style="color:#d14">&#39;pink&#39;</span>)
</span></span><span style="display:flex;"><span>    plt<span style="color:#000;font-weight:bold">.</span>bar(np<span style="color:#000;font-weight:bold">.</span>arange(<span style="color:#0086b3">len</span>(name_list)), september_list, label<span style="color:#000;font-weight:bold">=</span><span style="color:#d14">u</span><span style="color:#d14">&#39;9月业绩&#39;</span>, bottom<span style="color:#000;font-weight:bold">=</span>january_list<span style="color:#000;font-weight:bold">+</span>february_list<span style="color:#000;font-weight:bold">+</span>march_list<span style="color:#000;font-weight:bold">+</span>april_list<span style="color:#000;font-weight:bold">+</span>may_list<span style="color:#000;font-weight:bold">+</span>june_list<span style="color:#000;font-weight:bold">+</span>july_list<span style="color:#000;font-weight:bold">+</span>august_list, tick_label<span style="color:#000;font-weight:bold">=</span>name_list, fc<span style="color:#000;font-weight:bold">=</span><span style="color:#d14">&#39;olive&#39;</span>)
</span></span><span style="display:flex;"><span>    plt<span style="color:#000;font-weight:bold">.</span>bar(np<span style="color:#000;font-weight:bold">.</span>arange(<span style="color:#0086b3">len</span>(name_list)), october_list, label<span style="color:#000;font-weight:bold">=</span><span style="color:#d14">u</span><span style="color:#d14">&#39;10月业绩&#39;</span>, bottom<span style="color:#000;font-weight:bold">=</span>january_list<span style="color:#000;font-weight:bold">+</span>february_list<span style="color:#000;font-weight:bold">+</span>march_list<span style="color:#000;font-weight:bold">+</span>april_list<span style="color:#000;font-weight:bold">+</span>may_list<span style="color:#000;font-weight:bold">+</span>june_list<span style="color:#000;font-weight:bold">+</span>july_list<span style="color:#000;font-weight:bold">+</span>august_list<span style="color:#000;font-weight:bold">+</span>september_list, tick_label<span style="color:#000;font-weight:bold">=</span>name_list, fc<span style="color:#000;font-weight:bold">=</span><span style="color:#d14">&#39;navy&#39;</span>)
</span></span><span style="display:flex;"><span>    plt<span style="color:#000;font-weight:bold">.</span>bar(np<span style="color:#000;font-weight:bold">.</span>arange(<span style="color:#0086b3">len</span>(name_list)), november_list, label<span style="color:#000;font-weight:bold">=</span><span style="color:#d14">u</span><span style="color:#d14">&#39;11月业绩&#39;</span>, bottom<span style="color:#000;font-weight:bold">=</span>january_list<span style="color:#000;font-weight:bold">+</span>february_list<span style="color:#000;font-weight:bold">+</span>march_list<span style="color:#000;font-weight:bold">+</span>april_list<span style="color:#000;font-weight:bold">+</span>may_list<span style="color:#000;font-weight:bold">+</span>june_list<span style="color:#000;font-weight:bold">+</span>july_list<span style="color:#000;font-weight:bold">+</span>august_list<span style="color:#000;font-weight:bold">+</span>september_list<span style="color:#000;font-weight:bold">+</span>october_list, tick_label<span style="color:#000;font-weight:bold">=</span>name_list, fc<span style="color:#000;font-weight:bold">=</span><span style="color:#d14">&#39;linen&#39;</span>)
</span></span><span style="display:flex;"><span>    plt<span style="color:#000;font-weight:bold">.</span>bar(np<span style="color:#000;font-weight:bold">.</span>arange(<span style="color:#0086b3">len</span>(name_list)), december_list, label<span style="color:#000;font-weight:bold">=</span><span style="color:#d14">u</span><span style="color:#d14">&#39;12月业绩&#39;</span>, bottom<span style="color:#000;font-weight:bold">=</span>january_list<span style="color:#000;font-weight:bold">+</span>february_list<span style="color:#000;font-weight:bold">+</span>march_list<span style="color:#000;font-weight:bold">+</span>april_list<span style="color:#000;font-weight:bold">+</span>may_list<span style="color:#000;font-weight:bold">+</span>june_list<span style="color:#000;font-weight:bold">+</span>july_list<span style="color:#000;font-weight:bold">+</span>august_list<span style="color:#000;font-weight:bold">+</span>september_list<span style="color:#000;font-weight:bold">+</span>october_list<span style="color:#000;font-weight:bold">+</span>november_list, tick_label<span style="color:#000;font-weight:bold">=</span>name_list, fc<span style="color:#000;font-weight:bold">=</span><span style="color:#d14">&#39;teal&#39;</span>)
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># 添加数据标签，也就是给柱子顶部添加标签</span>
</span></span><span style="display:flex;"><span>    x <span style="color:#000;font-weight:bold">=</span> np<span style="color:#000;font-weight:bold">.</span>arange(<span style="color:#0086b3">len</span>(name_list))
</span></span><span style="display:flex;"><span>    y1 <span style="color:#000;font-weight:bold">=</span> np<span style="color:#000;font-weight:bold">.</span>array(<span style="color:#0086b3">list</span>(january_list<span style="color:#000;font-weight:bold">.</span>values))
</span></span><span style="display:flex;"><span>    <span style="color:#000;font-weight:bold">for</span> a, b <span style="color:#000;font-weight:bold">in</span> <span style="color:#0086b3">zip</span>(x, y1):
</span></span><span style="display:flex;"><span>        plt<span style="color:#000;font-weight:bold">.</span>text(a, b <span style="color:#000;font-weight:bold">+</span> <span style="color:#099">0.05</span>, <span style="color:#d14">&#39;</span><span style="color:#d14">%.0f</span><span style="color:#d14">&#39;</span> <span style="color:#000;font-weight:bold">%</span> b, ha<span style="color:#000;font-weight:bold">=</span><span style="color:#d14">&#39;center&#39;</span>, va<span style="color:#000;font-weight:bold">=</span><span style="color:#d14">&#39;bottom&#39;</span>, fontsize<span style="color:#000;font-weight:bold">=</span><span style="color:#099">24</span>)
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>    y2 <span style="color:#000;font-weight:bold">=</span> np<span style="color:#000;font-weight:bold">.</span>array(<span style="color:#0086b3">list</span>((january_list<span style="color:#000;font-weight:bold">+</span>february_list)<span style="color:#000;font-weight:bold">.</span>values))
</span></span><span style="display:flex;"><span>    <span style="color:#000;font-weight:bold">for</span> a, b <span style="color:#000;font-weight:bold">in</span> <span style="color:#0086b3">zip</span>(x, y2):
</span></span><span style="display:flex;"><span>        plt<span style="color:#000;font-weight:bold">.</span>text(a, b <span style="color:#000;font-weight:bold">+</span> <span style="color:#099">0.05</span>, <span style="color:#d14">&#39;</span><span style="color:#d14">%.0f</span><span style="color:#d14">&#39;</span> <span style="color:#000;font-weight:bold">%</span> b, ha<span style="color:#000;font-weight:bold">=</span><span style="color:#d14">&#39;center&#39;</span>, va<span style="color:#000;font-weight:bold">=</span><span style="color:#d14">&#39;bottom&#39;</span>, fontsize<span style="color:#000;font-weight:bold">=</span><span style="color:#099">24</span>)
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>    y3 <span style="color:#000;font-weight:bold">=</span> np<span style="color:#000;font-weight:bold">.</span>array(<span style="color:#0086b3">list</span>((january_list<span style="color:#000;font-weight:bold">+</span>february_list<span style="color:#000;font-weight:bold">+</span>march_list)<span style="color:#000;font-weight:bold">.</span>values))
</span></span><span style="display:flex;"><span>    <span style="color:#000;font-weight:bold">for</span> a, b <span style="color:#000;font-weight:bold">in</span> <span style="color:#0086b3">zip</span>(x, y3):
</span></span><span style="display:flex;"><span>        plt<span style="color:#000;font-weight:bold">.</span>text(a, b <span style="color:#000;font-weight:bold">+</span> <span style="color:#099">0.05</span>, <span style="color:#d14">&#39;</span><span style="color:#d14">%.0f</span><span style="color:#d14">&#39;</span> <span style="color:#000;font-weight:bold">%</span> b, ha<span style="color:#000;font-weight:bold">=</span><span style="color:#d14">&#39;center&#39;</span>, va<span style="color:#000;font-weight:bold">=</span><span style="color:#d14">&#39;bottom&#39;</span>, fontsize<span style="color:#000;font-weight:bold">=</span><span style="color:#099">24</span>)
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>    y4 <span style="color:#000;font-weight:bold">=</span> np<span style="color:#000;font-weight:bold">.</span>array(<span style="color:#0086b3">list</span>((january_list<span style="color:#000;font-weight:bold">+</span>february_list<span style="color:#000;font-weight:bold">+</span>march_list<span style="color:#000;font-weight:bold">+</span>april_list)<span style="color:#000;font-weight:bold">.</span>values))
</span></span><span style="display:flex;"><span>    <span style="color:#000;font-weight:bold">for</span> a, b <span style="color:#000;font-weight:bold">in</span> <span style="color:#0086b3">zip</span>(x, y4):
</span></span><span style="display:flex;"><span>        plt<span style="color:#000;font-weight:bold">.</span>text(a, b <span style="color:#000;font-weight:bold">+</span> <span style="color:#099">0.05</span>, <span style="color:#d14">&#39;</span><span style="color:#d14">%.0f</span><span style="color:#d14">&#39;</span> <span style="color:#000;font-weight:bold">%</span> b, ha<span style="color:#000;font-weight:bold">=</span><span style="color:#d14">&#39;center&#39;</span>, va<span style="color:#000;font-weight:bold">=</span><span style="color:#d14">&#39;bottom&#39;</span>, fontsize<span style="color:#000;font-weight:bold">=</span><span style="color:#099">24</span>)
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>    y5 <span style="color:#000;font-weight:bold">=</span> np<span style="color:#000;font-weight:bold">.</span>array(<span style="color:#0086b3">list</span>((january_list<span style="color:#000;font-weight:bold">+</span>february_list<span style="color:#000;font-weight:bold">+</span>march_list<span style="color:#000;font-weight:bold">+</span>april_list<span style="color:#000;font-weight:bold">+</span>may_list)<span style="color:#000;font-weight:bold">.</span>values))
</span></span><span style="display:flex;"><span>    <span style="color:#000;font-weight:bold">for</span> a, b <span style="color:#000;font-weight:bold">in</span> <span style="color:#0086b3">zip</span>(x, y5):
</span></span><span style="display:flex;"><span>        plt<span style="color:#000;font-weight:bold">.</span>text(a, b <span style="color:#000;font-weight:bold">+</span> <span style="color:#099">0.05</span>, <span style="color:#d14">&#39;</span><span style="color:#d14">%.0f</span><span style="color:#d14">&#39;</span> <span style="color:#000;font-weight:bold">%</span> b, ha<span style="color:#000;font-weight:bold">=</span><span style="color:#d14">&#39;center&#39;</span>, va<span style="color:#000;font-weight:bold">=</span><span style="color:#d14">&#39;bottom&#39;</span>, fontsize<span style="color:#000;font-weight:bold">=</span><span style="color:#099">24</span>)
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>    y6 <span style="color:#000;font-weight:bold">=</span> np<span style="color:#000;font-weight:bold">.</span>array(<span style="color:#0086b3">list</span>((january_list<span style="color:#000;font-weight:bold">+</span>february_list<span style="color:#000;font-weight:bold">+</span>march_list<span style="color:#000;font-weight:bold">+</span>april_list<span style="color:#000;font-weight:bold">+</span>may_list<span style="color:#000;font-weight:bold">+</span>june_list)<span style="color:#000;font-weight:bold">.</span>values))
</span></span><span style="display:flex;"><span>    <span style="color:#000;font-weight:bold">for</span> a, b <span style="color:#000;font-weight:bold">in</span> <span style="color:#0086b3">zip</span>(x, y6):
</span></span><span style="display:flex;"><span>        plt<span style="color:#000;font-weight:bold">.</span>text(a, b <span style="color:#000;font-weight:bold">+</span> <span style="color:#099">0.05</span>, <span style="color:#d14">&#39;</span><span style="color:#d14">%.0f</span><span style="color:#d14">&#39;</span> <span style="color:#000;font-weight:bold">%</span> b, ha<span style="color:#000;font-weight:bold">=</span><span style="color:#d14">&#39;center&#39;</span>, va<span style="color:#000;font-weight:bold">=</span><span style="color:#d14">&#39;bottom&#39;</span>, fontsize<span style="color:#000;font-weight:bold">=</span><span style="color:#099">24</span>)
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>    y7 <span style="color:#000;font-weight:bold">=</span> np<span style="color:#000;font-weight:bold">.</span>array(<span style="color:#0086b3">list</span>((january_list<span style="color:#000;font-weight:bold">+</span>february_list<span style="color:#000;font-weight:bold">+</span>march_list<span style="color:#000;font-weight:bold">+</span>april_list<span style="color:#000;font-weight:bold">+</span>may_list<span style="color:#000;font-weight:bold">+</span>june_list<span style="color:#000;font-weight:bold">+</span>july_list)<span style="color:#000;font-weight:bold">.</span>values))
</span></span><span style="display:flex;"><span>    <span style="color:#000;font-weight:bold">for</span> a, b <span style="color:#000;font-weight:bold">in</span> <span style="color:#0086b3">zip</span>(x, y7):
</span></span><span style="display:flex;"><span>        plt<span style="color:#000;font-weight:bold">.</span>text(a, b <span style="color:#000;font-weight:bold">+</span> <span style="color:#099">0.05</span>, <span style="color:#d14">&#39;</span><span style="color:#d14">%.0f</span><span style="color:#d14">&#39;</span> <span style="color:#000;font-weight:bold">%</span> b, ha<span style="color:#000;font-weight:bold">=</span><span style="color:#d14">&#39;center&#39;</span>, va<span style="color:#000;font-weight:bold">=</span><span style="color:#d14">&#39;bottom&#39;</span>, fontsize<span style="color:#000;font-weight:bold">=</span><span style="color:#099">24</span>)
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>    y8 <span style="color:#000;font-weight:bold">=</span> np<span style="color:#000;font-weight:bold">.</span>array(<span style="color:#0086b3">list</span>((january_list<span style="color:#000;font-weight:bold">+</span>february_list<span style="color:#000;font-weight:bold">+</span>march_list<span style="color:#000;font-weight:bold">+</span>april_list<span style="color:#000;font-weight:bold">+</span>may_list<span style="color:#000;font-weight:bold">+</span>june_list<span style="color:#000;font-weight:bold">+</span>july_list<span style="color:#000;font-weight:bold">+</span>august_list)<span style="color:#000;font-weight:bold">.</span>values))
</span></span><span style="display:flex;"><span>    <span style="color:#000;font-weight:bold">for</span> a, b <span style="color:#000;font-weight:bold">in</span> <span style="color:#0086b3">zip</span>(x, y8):
</span></span><span style="display:flex;"><span>        plt<span style="color:#000;font-weight:bold">.</span>text(a, b <span style="color:#000;font-weight:bold">+</span> <span style="color:#099">0.05</span>, <span style="color:#d14">&#39;</span><span style="color:#d14">%.0f</span><span style="color:#d14">&#39;</span> <span style="color:#000;font-weight:bold">%</span> b, ha<span style="color:#000;font-weight:bold">=</span><span style="color:#d14">&#39;center&#39;</span>, va<span style="color:#000;font-weight:bold">=</span><span style="color:#d14">&#39;bottom&#39;</span>, fontsize<span style="color:#000;font-weight:bold">=</span><span style="color:#099">24</span>)
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>    y9 <span style="color:#000;font-weight:bold">=</span> np<span style="color:#000;font-weight:bold">.</span>array(<span style="color:#0086b3">list</span>((january_list<span style="color:#000;font-weight:bold">+</span>february_list<span style="color:#000;font-weight:bold">+</span>march_list<span style="color:#000;font-weight:bold">+</span>april_list<span style="color:#000;font-weight:bold">+</span>may_list<span style="color:#000;font-weight:bold">+</span>june_list<span style="color:#000;font-weight:bold">+</span>july_list<span style="color:#000;font-weight:bold">+</span>august_list<span style="color:#000;font-weight:bold">+</span>september_list)<span style="color:#000;font-weight:bold">.</span>values))
</span></span><span style="display:flex;"><span>    <span style="color:#000;font-weight:bold">for</span> a, b <span style="color:#000;font-weight:bold">in</span> <span style="color:#0086b3">zip</span>(x, y9):
</span></span><span style="display:flex;"><span>        plt<span style="color:#000;font-weight:bold">.</span>text(a, b <span style="color:#000;font-weight:bold">+</span> <span style="color:#099">0.05</span>, <span style="color:#d14">&#39;</span><span style="color:#d14">%.0f</span><span style="color:#d14">&#39;</span> <span style="color:#000;font-weight:bold">%</span> b, ha<span style="color:#000;font-weight:bold">=</span><span style="color:#d14">&#39;center&#39;</span>, va<span style="color:#000;font-weight:bold">=</span><span style="color:#d14">&#39;bottom&#39;</span>, fontsize<span style="color:#000;font-weight:bold">=</span><span style="color:#099">24</span>)
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>    y10 <span style="color:#000;font-weight:bold">=</span> np<span style="color:#000;font-weight:bold">.</span>array(<span style="color:#0086b3">list</span>((january_list<span style="color:#000;font-weight:bold">+</span>february_list<span style="color:#000;font-weight:bold">+</span>march_list<span style="color:#000;font-weight:bold">+</span>april_list<span style="color:#000;font-weight:bold">+</span>may_list<span style="color:#000;font-weight:bold">+</span>june_list<span style="color:#000;font-weight:bold">+</span>july_list<span style="color:#000;font-weight:bold">+</span>august_list<span style="color:#000;font-weight:bold">+</span>september_list<span style="color:#000;font-weight:bold">+</span>october_list)<span style="color:#000;font-weight:bold">.</span>values))
</span></span><span style="display:flex;"><span>    <span style="color:#000;font-weight:bold">for</span> a, b <span style="color:#000;font-weight:bold">in</span> <span style="color:#0086b3">zip</span>(x, y10):
</span></span><span style="display:flex;"><span>        plt<span style="color:#000;font-weight:bold">.</span>text(a, b <span style="color:#000;font-weight:bold">+</span> <span style="color:#099">0.05</span>, <span style="color:#d14">&#39;</span><span style="color:#d14">%.0f</span><span style="color:#d14">&#39;</span> <span style="color:#000;font-weight:bold">%</span> b, ha<span style="color:#000;font-weight:bold">=</span><span style="color:#d14">&#39;center&#39;</span>, va<span style="color:#000;font-weight:bold">=</span><span style="color:#d14">&#39;bottom&#39;</span>, fontsize<span style="color:#000;font-weight:bold">=</span><span style="color:#099">24</span>)
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>    y11 <span style="color:#000;font-weight:bold">=</span> np<span style="color:#000;font-weight:bold">.</span>array(<span style="color:#0086b3">list</span>((january_list<span style="color:#000;font-weight:bold">+</span>february_list<span style="color:#000;font-weight:bold">+</span>march_list<span style="color:#000;font-weight:bold">+</span>april_list<span style="color:#000;font-weight:bold">+</span>may_list<span style="color:#000;font-weight:bold">+</span>june_list<span style="color:#000;font-weight:bold">+</span>july_list<span style="color:#000;font-weight:bold">+</span>august_list<span style="color:#000;font-weight:bold">+</span>september_list<span style="color:#000;font-weight:bold">+</span>october_list<span style="color:#000;font-weight:bold">+</span>november_list)<span style="color:#000;font-weight:bold">.</span>values))
</span></span><span style="display:flex;"><span>    <span style="color:#000;font-weight:bold">for</span> a, b <span style="color:#000;font-weight:bold">in</span> <span style="color:#0086b3">zip</span>(x, y11):
</span></span><span style="display:flex;"><span>        plt<span style="color:#000;font-weight:bold">.</span>text(a, b <span style="color:#000;font-weight:bold">+</span> <span style="color:#099">0.05</span>, <span style="color:#d14">&#39;</span><span style="color:#d14">%.0f</span><span style="color:#d14">&#39;</span> <span style="color:#000;font-weight:bold">%</span> b, ha<span style="color:#000;font-weight:bold">=</span><span style="color:#d14">&#39;center&#39;</span>, va<span style="color:#000;font-weight:bold">=</span><span style="color:#d14">&#39;bottom&#39;</span>, fontsize<span style="color:#000;font-weight:bold">=</span><span style="color:#099">24</span>)
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>    y12 <span style="color:#000;font-weight:bold">=</span> np<span style="color:#000;font-weight:bold">.</span>array(<span style="color:#0086b3">list</span>((january_list<span style="color:#000;font-weight:bold">+</span>february_list<span style="color:#000;font-weight:bold">+</span>march_list<span style="color:#000;font-weight:bold">+</span>april_list<span style="color:#000;font-weight:bold">+</span>may_list<span style="color:#000;font-weight:bold">+</span>june_list<span style="color:#000;font-weight:bold">+</span>july_list<span style="color:#000;font-weight:bold">+</span>august_list<span style="color:#000;font-weight:bold">+</span>september_list<span style="color:#000;font-weight:bold">+</span>october_list<span style="color:#000;font-weight:bold">+</span>november_list<span style="color:#000;font-weight:bold">+</span>december_list)<span style="color:#000;font-weight:bold">.</span>values))
</span></span><span style="display:flex;"><span>    <span style="color:#000;font-weight:bold">for</span> a, b <span style="color:#000;font-weight:bold">in</span> <span style="color:#0086b3">zip</span>(x, y12):
</span></span><span style="display:flex;"><span>        plt<span style="color:#000;font-weight:bold">.</span>text(a, b <span style="color:#000;font-weight:bold">+</span> <span style="color:#099">0.05</span>, <span style="color:#d14">&#39;</span><span style="color:#d14">%.0f</span><span style="color:#d14">&#39;</span> <span style="color:#000;font-weight:bold">%</span> b, ha<span style="color:#000;font-weight:bold">=</span><span style="color:#d14">&#39;center&#39;</span>, va<span style="color:#000;font-weight:bold">=</span><span style="color:#d14">&#39;bottom&#39;</span>, fontsize<span style="color:#000;font-weight:bold">=</span><span style="color:#099">24</span>, color<span style="color:#000;font-weight:bold">=</span><span style="color:#d14">&#39;AliceBlue&#39;</span>)
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># 为了让x轴的内容适配展示的长度，请求路径字段比较长，有几十个字符</span>
</span></span><span style="display:flex;"><span>    plt<span style="color:#000;font-weight:bold">.</span>xticks(np<span style="color:#000;font-weight:bold">.</span>arange(<span style="color:#0086b3">len</span>(name_list)), name_list)
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># 统计图的标题</span>
</span></span><span style="display:flex;"><span>    plt<span style="color:#000;font-weight:bold">.</span>title(<span style="color:#d14">u</span><span style="color:#d14">&#34;XX公司部门每月销售额&#34;</span>, size<span style="color:#000;font-weight:bold">=</span><span style="color:#099">32</span>)
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># 显示图例</span>
</span></span><span style="display:flex;"><span>    plt<span style="color:#000;font-weight:bold">.</span>legend()
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># X坐标-横坐标标题</span>
</span></span><span style="display:flex;"><span>    plt<span style="color:#000;font-weight:bold">.</span>xlabel(<span style="color:#d14">u</span><span style="color:#d14">&#39;部门名称&#39;</span>, size<span style="color:#000;font-weight:bold">=</span><span style="color:#099">24</span>)
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># Y坐标-纵坐标标题</span>
</span></span><span style="display:flex;"><span>    plt<span style="color:#000;font-weight:bold">.</span>ylabel(<span style="color:#d14">u</span><span style="color:#d14">&#39;销售额&#39;</span>, size<span style="color:#000;font-weight:bold">=</span><span style="color:#099">24</span>)
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># 在展示图片前可以将画出的曲线保存到自己路径下的文件夹中</span>
</span></span><span style="display:flex;"><span>    plt<span style="color:#000;font-weight:bold">.</span>savefig(out_path)
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># 显示图像</span>
</span></span><span style="display:flex;"><span>    plt<span style="color:#000;font-weight:bold">.</span>show()
</span></span><span style="display:flex;"><span>    <span style="color:#0086b3">print</span>(<span style="color:#d14">&#34;all picture is starting&#34;</span>)
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">if</span> __name__ <span style="color:#000;font-weight:bold">==</span> <span style="color:#d14">&#34;__main__&#34;</span>:
</span></span><span style="display:flex;"><span>    main()
</span></span></code></pre></td></tr></table>
</div>
</div><h3 id="34-饼状图">3.4 饼状图</h3>
<table>
<thead>
<tr>
<th>说明</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td>适用场景</td>
<td>显示各项的大小与各项总和的比例。适用简单的占比比例图，在不要求数据精细的情况适用。</td>
</tr>
<tr>
<td>优势</td>
<td>明确显示数据的比例情况，尤其合适渠道来源等场景。</td>
</tr>
<tr>
<td>劣势</td>
<td>不会具体的数值，只是整体的占比情况。</td>
</tr>
</tbody>
</table>
<h4 id="示例-2">示例：</h4>
<div class="highlight"><div style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">
<table style="border-spacing:0;padding:0;margin:0;border:0;"><tr><td style="vertical-align:top;padding:0;margin:0;border:0;">
<pre tabindex="0" style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">1
</span></code></pre></td>
<td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
<pre tabindex="0" style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-python" data-lang="python"><span style="display:flex;"><span>plt<span style="color:#000;font-weight:bold">.</span>pie(money_list, explode<span style="color:#000;font-weight:bold">=</span>explode, labels<span style="color:#000;font-weight:bold">=</span>label_list, autopct<span style="color:#000;font-weight:bold">=</span><span style="color:#d14">&#39;</span><span style="color:#d14">%1.1f%%</span><span style="color:#d14">&#39;</span>, textprops<span style="color:#000;font-weight:bold">=</span>{<span style="color:#d14">&#39;fontsize&#39;</span>: <span style="color:#099">43</span>, <span style="color:#d14">&#39;color&#39;</span>: <span style="color:#d14">&#39;k&#39;</span>}, shadow<span style="color:#000;font-weight:bold">=</span><span style="color:#000;font-weight:bold">True</span>, startangle<span style="color:#000;font-weight:bold">=</span><span style="color:#099">90</span>)
</span></span></code></pre></td></tr></table>
</div>
</div><h4 id="demo-3">demo:</h4>
<div class="highlight"><div style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">
<table style="border-spacing:0;padding:0;margin:0;border:0;"><tr><td style="vertical-align:top;padding:0;margin:0;border:0;">
<pre tabindex="0" style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 1
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 2
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 3
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 4
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 5
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 6
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 7
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 8
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 9
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">10
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">11
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">12
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">13
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">14
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">15
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">16
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">17
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">18
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">19
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">20
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">21
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">22
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">23
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">24
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">25
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">26
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">27
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">28
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">29
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">30
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">31
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">32
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">33
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">34
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">35
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">36
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">37
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">38
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">39
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">40
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">41
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">42
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">43
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">44
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">45
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">46
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">47
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">48
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">49
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">50
</span></code></pre></td>
<td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
<pre tabindex="0" style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-python" data-lang="python"><span style="display:flex;"><span><span style="color:#998;font-style:italic"># -*- coding:utf-8 -*-</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">import</span> <span style="color:#555">pandas</span> <span style="color:#000;font-weight:bold">as</span> <span style="color:#555">pd</span>
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">import</span> <span style="color:#555">matplotlib.pyplot</span> <span style="color:#000;font-weight:bold">as</span> <span style="color:#555">plt</span>
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">import</span> <span style="color:#555">numpy</span> <span style="color:#000;font-weight:bold">as</span> <span style="color:#555">np</span>
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">import</span> <span style="color:#555">os</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>plt<span style="color:#000;font-weight:bold">.</span>rcParams[<span style="color:#d14">&#39;font.sans-serif&#39;</span>] <span style="color:#000;font-weight:bold">=</span> [<span style="color:#d14">&#39;SimHei&#39;</span>]
</span></span><span style="display:flex;"><span>plt<span style="color:#000;font-weight:bold">.</span>rcParams[<span style="color:#d14">&#39;font.family&#39;</span>] <span style="color:#000;font-weight:bold">=</span> <span style="color:#d14">&#39;sans-serif&#39;</span>
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># 解决负号&#39;-&#39;显示为方块的问题</span>
</span></span><span style="display:flex;"><span>plt<span style="color:#000;font-weight:bold">.</span>rcParams[<span style="color:#d14">&#39;axes.unicode_minus&#39;</span>] <span style="color:#000;font-weight:bold">=</span> <span style="color:#000;font-weight:bold">False</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># 相对路径</span>
</span></span><span style="display:flex;"><span>project_dir <span style="color:#000;font-weight:bold">=</span> os<span style="color:#000;font-weight:bold">.</span>path<span style="color:#000;font-weight:bold">.</span>abspath(<span style="color:#d14">&#39;.&#39;</span>)
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>path <span style="color:#000;font-weight:bold">=</span> project_dir <span style="color:#000;font-weight:bold">+</span> <span style="color:#d14">&#34;</span><span style="color:#d14">\\</span><span style="color:#d14">pie.csv&#34;</span>
</span></span><span style="display:flex;"><span>out_path <span style="color:#000;font-weight:bold">=</span> project_dir <span style="color:#000;font-weight:bold">+</span> <span style="color:#d14">&#34;</span><span style="color:#d14">\\</span><span style="color:#d14">request_pie.jpg&#34;</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># 全路径</span>
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># path = &#34;D:\\request.csv&#34;</span>
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># out_path = &#34;D:\\request.jpg&#34;</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">def</span> <span style="color:#900;font-weight:bold">main</span>():
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># 使用python下pandas库读取csv文件</span>
</span></span><span style="display:flex;"><span>    data <span style="color:#000;font-weight:bold">=</span> pd<span style="color:#000;font-weight:bold">.</span>read_csv(path, encoding<span style="color:#000;font-weight:bold">=</span><span style="color:#d14">&#39;utf-8&#39;</span>)
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># 读取列名为距离误差和时间点的所有行数据</span>
</span></span><span style="display:flex;"><span>    label_list <span style="color:#000;font-weight:bold">=</span> data<span style="color:#000;font-weight:bold">.</span>loc[:, <span style="color:#d14">&#39;月份&#39;</span>]
</span></span><span style="display:flex;"><span>    money_list <span style="color:#000;font-weight:bold">=</span> data<span style="color:#000;font-weight:bold">.</span>loc[:, <span style="color:#d14">&#39;销售&#39;</span>]
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># 设定各项距离圆心n个半径</span>
</span></span><span style="display:flex;"><span>    explode <span style="color:#000;font-weight:bold">=</span> [<span style="color:#099">0</span>, <span style="color:#099">0</span>, <span style="color:#099">0</span>, <span style="color:#099">0</span>, <span style="color:#099">0</span>, <span style="color:#099">0</span>, <span style="color:#099">0</span>, <span style="color:#099">0</span>, <span style="color:#099">0</span>, <span style="color:#099">0</span>, <span style="color:#099">0</span>, <span style="color:#099">0</span>]
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># 设置画布</span>
</span></span><span style="display:flex;"><span>    plt<span style="color:#000;font-weight:bold">.</span>figure(num<span style="color:#000;font-weight:bold">=</span><span style="color:#099">1</span>, dpi<span style="color:#000;font-weight:bold">=</span><span style="color:#099">100</span>, figsize<span style="color:#000;font-weight:bold">=</span>(<span style="color:#099">24</span>, <span style="color:#099">32</span>))
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># 饼状图</span>
</span></span><span style="display:flex;"><span>    plt<span style="color:#000;font-weight:bold">.</span>pie(money_list, explode<span style="color:#000;font-weight:bold">=</span>explode, labels<span style="color:#000;font-weight:bold">=</span>label_list, autopct<span style="color:#000;font-weight:bold">=</span><span style="color:#d14">&#39;</span><span style="color:#d14">%1.1f%%</span><span style="color:#d14">&#39;</span>, textprops<span style="color:#000;font-weight:bold">=</span>{<span style="color:#d14">&#39;fontsize&#39;</span>: <span style="color:#099">43</span>, <span style="color:#d14">&#39;color&#39;</span>: <span style="color:#d14">&#39;k&#39;</span>}, shadow<span style="color:#000;font-weight:bold">=</span><span style="color:#000;font-weight:bold">True</span>, startangle<span style="color:#000;font-weight:bold">=</span><span style="color:#099">90</span>)
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># 显示图例</span>
</span></span><span style="display:flex;"><span>    plt<span style="color:#000;font-weight:bold">.</span>legend()
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># 统计图的标题</span>
</span></span><span style="display:flex;"><span>    plt<span style="color:#000;font-weight:bold">.</span>title(<span style="color:#d14">u</span><span style="color:#d14">&#34;XX公司部门每月销售额&#34;</span>, size<span style="color:#000;font-weight:bold">=</span><span style="color:#099">32</span>)
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># 在展示图片前可以将画出的曲线保存到自己路径下的文件夹中</span>
</span></span><span style="display:flex;"><span>    plt<span style="color:#000;font-weight:bold">.</span>savefig(out_path)
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># 显示图像</span>
</span></span><span style="display:flex;"><span>    plt<span style="color:#000;font-weight:bold">.</span>show()
</span></span><span style="display:flex;"><span>    <span style="color:#0086b3">print</span>(<span style="color:#d14">&#34;all picture is starting&#34;</span>)
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">if</span> __name__ <span style="color:#000;font-weight:bold">==</span> <span style="color:#d14">&#34;__main__&#34;</span>:
</span></span><span style="display:flex;"><span>    main()
</span></span></code></pre></td></tr></table>
</div>
</div><h3 id="35-散点图">3.5 散点图</h3>
<table>
<thead>
<tr>
<th>说明</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td>适用场景</td>
<td>显示若干数据系列中各数值之间的关系，类似XY轴，判断两变量之间是否存在某种关联。散点图适用于三维数据集，但其中只有两维数据是需要比较的。另外，散点图还可以看出极值的分布情况。</td>
</tr>
<tr>
<td>优势</td>
<td>对于处理值的分布和数据点的分簇区域（通过设置横纵项的辅助线），散点图都很理想。如果数据集中包含非常多的点，那么散点图便是最佳图表类型。</td>
</tr>
<tr>
<td>劣势</td>
<td>在点状图中显示多个序列看上去非常混乱。</td>
</tr>
</tbody>
</table>
<h4 id="demo-4">demo:</h4>
<div class="highlight"><div style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">
<table style="border-spacing:0;padding:0;margin:0;border:0;"><tr><td style="vertical-align:top;padding:0;margin:0;border:0;">
<pre tabindex="0" style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 1
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 2
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 3
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 4
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 5
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 6
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 7
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 8
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 9
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">10
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">11
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">12
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">13
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">14
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">15
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">16
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">17
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">18
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">19
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">20
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">21
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">22
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">23
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">24
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">25
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">26
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">27
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">28
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">29
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">30
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">31
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">32
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">33
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">34
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">35
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">36
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">37
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">38
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">39
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">40
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">41
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">42
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">43
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">44
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">45
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">46
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">47
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">48
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">49
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">50
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">51
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">52
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">53
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">54
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">55
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">56
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">57
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">58
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">59
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">60
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">61
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">62
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">63
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">64
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">65
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">66
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">67
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">68
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">69
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">70
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">71
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">72
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">73
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">74
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">75
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">76
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">77
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">78
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">79
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">80
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">81
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">82
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">83
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">84
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">85
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">86
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">87
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">88
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">89
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">90
</span></code></pre></td>
<td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
<pre tabindex="0" style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-python" data-lang="python"><span style="display:flex;"><span><span style="color:#998;font-style:italic"># !/usr/bin/python3</span>
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># -*- coding: utf-8 -*-</span>
</span></span><span style="display:flex;"><span><span style="color:#d14">&#34;&#34;&#34;
</span></span></span><span style="display:flex;"><span><span style="color:#d14">@Description    :  散点图
</span></span></span><span style="display:flex;"><span><span style="color:#d14">@Author         :  Anttu
</span></span></span><span style="display:flex;"><span><span style="color:#d14">@Version        :  v1.0
</span></span></span><span style="display:flex;"><span><span style="color:#d14">@File           :  testScatter.py
</span></span></span><span style="display:flex;"><span><span style="color:#d14">@CreateTime     :  15/5/2021 21:28
</span></span></span><span style="display:flex;"><span><span style="color:#d14">&#34;&#34;&#34;</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">import</span> <span style="color:#555">pandas</span> <span style="color:#000;font-weight:bold">as</span> <span style="color:#555">pd</span>
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">import</span> <span style="color:#555">matplotlib.pyplot</span> <span style="color:#000;font-weight:bold">as</span> <span style="color:#555">plt</span>
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">import</span> <span style="color:#555">numpy</span> <span style="color:#000;font-weight:bold">as</span> <span style="color:#555">np</span>
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">import</span> <span style="color:#555">os</span>
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">import</span> <span style="color:#555">platform</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># 系统</span>
</span></span><span style="display:flex;"><span><span style="color:#0086b3">print</span>(platform<span style="color:#000;font-weight:bold">.</span>system())
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># 相对路径</span>
</span></span><span style="display:flex;"><span>project_dir <span style="color:#000;font-weight:bold">=</span> os<span style="color:#000;font-weight:bold">.</span>path<span style="color:#000;font-weight:bold">.</span>abspath(<span style="color:#d14">&#39;.&#39;</span>)
</span></span><span style="display:flex;"><span><span style="color:#0086b3">print</span>(project_dir)
</span></span><span style="display:flex;"><span>fileName <span style="color:#000;font-weight:bold">=</span> <span style="color:#d14">&#34;scatter.csv&#34;</span>
</span></span><span style="display:flex;"><span>outFileName <span style="color:#000;font-weight:bold">=</span> <span style="color:#d14">&#34;request_scatter.jpg&#34;</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>fontName <span style="color:#000;font-weight:bold">=</span> <span style="color:#d14">&#34;SimHei&#34;</span>
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">if</span> platform<span style="color:#000;font-weight:bold">.</span>system() <span style="color:#000;font-weight:bold">==</span> <span style="color:#d14">&#39;Windows&#39;</span>:
</span></span><span style="display:flex;"><span>    <span style="color:#0086b3">print</span>(<span style="color:#d14">&#39;Windows系统&#39;</span>)
</span></span><span style="display:flex;"><span>    fontName <span style="color:#000;font-weight:bold">=</span> [<span style="color:#d14">&#34;SimHei&#34;</span>]
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">elif</span> platform<span style="color:#000;font-weight:bold">.</span>system() <span style="color:#000;font-weight:bold">==</span> <span style="color:#d14">&#39;Linux&#39;</span>:
</span></span><span style="display:flex;"><span>    <span style="color:#0086b3">print</span>(<span style="color:#d14">&#39;Linux系统&#39;</span>)
</span></span><span style="display:flex;"><span>    fontName <span style="color:#000;font-weight:bold">=</span> [<span style="color:#d14">&#34;SimHei&#34;</span>]
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">elif</span> platform<span style="color:#000;font-weight:bold">.</span>system() <span style="color:#000;font-weight:bold">==</span> <span style="color:#d14">&#39;Darwin&#39;</span>:
</span></span><span style="display:flex;"><span>    <span style="color:#0086b3">print</span>(<span style="color:#d14">&#39;MacOS系统&#39;</span>)
</span></span><span style="display:flex;"><span>    fontName <span style="color:#000;font-weight:bold">=</span> [<span style="color:#d14">&#34;PingFang HK&#34;</span>]
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">else</span>:
</span></span><span style="display:flex;"><span>    <span style="color:#0086b3">print</span>(<span style="color:#d14">&#39;其他&#39;</span>)
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># Mac字体 PingFang HK</span>
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># win字体 SimHei</span>
</span></span><span style="display:flex;"><span>plt<span style="color:#000;font-weight:bold">.</span>rcParams[<span style="color:#d14">&#39;font.sans-serif&#39;</span>] <span style="color:#000;font-weight:bold">=</span> fontName
</span></span><span style="display:flex;"><span>plt<span style="color:#000;font-weight:bold">.</span>rcParams[<span style="color:#d14">&#39;font.family&#39;</span>] <span style="color:#000;font-weight:bold">=</span> <span style="color:#d14">&#39;sans-serif&#39;</span>
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># 解决负号&#39;-&#39;显示为方块的问题</span>
</span></span><span style="display:flex;"><span>plt<span style="color:#000;font-weight:bold">.</span>rcParams[<span style="color:#d14">&#39;axes.unicode_minus&#39;</span>] <span style="color:#000;font-weight:bold">=</span> <span style="color:#000;font-weight:bold">False</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>filePath <span style="color:#000;font-weight:bold">=</span> os<span style="color:#000;font-weight:bold">.</span>sep<span style="color:#000;font-weight:bold">.</span>join([project_dir, fileName])
</span></span><span style="display:flex;"><span>outPath <span style="color:#000;font-weight:bold">=</span> os<span style="color:#000;font-weight:bold">.</span>sep<span style="color:#000;font-weight:bold">.</span>join([project_dir, outFileName])
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># 全路径</span>
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># filePath = &#34;D:\\request.csv&#34;</span>
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># outPath = &#34;D:\\request.jpg&#34;</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">def</span> <span style="color:#900;font-weight:bold">main</span>():
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># 使用python下pandas库读取csv文件</span>
</span></span><span style="display:flex;"><span>    data <span style="color:#000;font-weight:bold">=</span> pd<span style="color:#000;font-weight:bold">.</span>read_csv(filePath, encoding<span style="color:#000;font-weight:bold">=</span><span style="color:#d14">&#39;utf-8&#39;</span>)
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># 读取列名</span>
</span></span><span style="display:flex;"><span>    height <span style="color:#000;font-weight:bold">=</span> data<span style="color:#000;font-weight:bold">.</span>loc[:, [<span style="color:#d14">&#39;性别&#39;</span>, <span style="color:#d14">&#39;身高&#39;</span>]]
</span></span><span style="display:flex;"><span>    weight <span style="color:#000;font-weight:bold">=</span> data<span style="color:#000;font-weight:bold">.</span>loc[:, [<span style="color:#d14">&#39;性别&#39;</span>, <span style="color:#d14">&#39;体重&#39;</span>]]
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># 身高</span>
</span></span><span style="display:flex;"><span>    male_height <span style="color:#000;font-weight:bold">=</span> height<span style="color:#000;font-weight:bold">.</span>loc[height[<span style="color:#d14">&#39;性别&#39;</span>] <span style="color:#000;font-weight:bold">==</span> <span style="color:#099">1</span>]
</span></span><span style="display:flex;"><span>    female_height <span style="color:#000;font-weight:bold">=</span> height<span style="color:#000;font-weight:bold">.</span>loc[height[<span style="color:#d14">&#39;性别&#39;</span>] <span style="color:#000;font-weight:bold">==</span> <span style="color:#099">0</span>]
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># 体重</span>
</span></span><span style="display:flex;"><span>    male_weight <span style="color:#000;font-weight:bold">=</span> weight<span style="color:#000;font-weight:bold">.</span>loc[weight[<span style="color:#d14">&#39;性别&#39;</span>] <span style="color:#000;font-weight:bold">==</span> <span style="color:#099">1</span>]
</span></span><span style="display:flex;"><span>    female_weight <span style="color:#000;font-weight:bold">=</span> weight<span style="color:#000;font-weight:bold">.</span>loc[weight[<span style="color:#d14">&#39;性别&#39;</span>] <span style="color:#000;font-weight:bold">==</span> <span style="color:#099">0</span>]
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># 设置画布</span>
</span></span><span style="display:flex;"><span>    plt<span style="color:#000;font-weight:bold">.</span>figure(dpi<span style="color:#000;font-weight:bold">=</span><span style="color:#099">100</span>, figsize<span style="color:#000;font-weight:bold">=</span>(<span style="color:#099">24</span>, <span style="color:#099">32</span>))
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># 散点图</span>
</span></span><span style="display:flex;"><span>    plt<span style="color:#000;font-weight:bold">.</span>scatter(male_height, male_weight, marker<span style="color:#000;font-weight:bold">=</span><span style="color:#d14">&#39;x&#39;</span>, color<span style="color:#000;font-weight:bold">=</span><span style="color:#d14">&#39;b&#39;</span>, alpha<span style="color:#000;font-weight:bold">=</span><span style="color:#099">0.5</span>)
</span></span><span style="display:flex;"><span>    plt<span style="color:#000;font-weight:bold">.</span>scatter(female_height, female_weight, color<span style="color:#000;font-weight:bold">=</span><span style="color:#d14">&#39;r&#39;</span>, alpha<span style="color:#000;font-weight:bold">=</span><span style="color:#099">0.5</span>)
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># 显示图例</span>
</span></span><span style="display:flex;"><span>    plt<span style="color:#000;font-weight:bold">.</span>legend((<span style="color:#d14">&#39;Male&#39;</span>, <span style="color:#d14">&#39;Female&#39;</span>))
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># X坐标-横坐标标题</span>
</span></span><span style="display:flex;"><span>    plt<span style="color:#000;font-weight:bold">.</span>xlabel(<span style="color:#d14">u</span><span style="color:#d14">&#39;身高/Height(厘米)&#39;</span>, size<span style="color:#000;font-weight:bold">=</span><span style="color:#099">24</span>)
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># Y坐标-纵坐标标题</span>
</span></span><span style="display:flex;"><span>    plt<span style="color:#000;font-weight:bold">.</span>ylabel(<span style="color:#d14">u</span><span style="color:#d14">&#39;体重/Weight(公斤)&#39;</span>, size<span style="color:#000;font-weight:bold">=</span><span style="color:#099">24</span>)
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># 统计图的标题</span>
</span></span><span style="display:flex;"><span>    plt<span style="color:#000;font-weight:bold">.</span>title(<span style="color:#d14">u</span><span style="color:#d14">&#34;XX公司男女身高/体重分布&#34;</span>, size<span style="color:#000;font-weight:bold">=</span><span style="color:#099">32</span>)
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># 网格</span>
</span></span><span style="display:flex;"><span>    plt<span style="color:#000;font-weight:bold">.</span>grid(<span style="color:#000;font-weight:bold">True</span>)
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># 在展示图片前可以将画出的曲线保存到自己路径下的文件夹中</span>
</span></span><span style="display:flex;"><span>    plt<span style="color:#000;font-weight:bold">.</span>savefig(outPath)
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># 显示图像</span>
</span></span><span style="display:flex;"><span>    plt<span style="color:#000;font-weight:bold">.</span>show()
</span></span><span style="display:flex;"><span>    <span style="color:#0086b3">print</span>(<span style="color:#d14">&#34;all picture is starting&#34;</span>)
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">if</span> __name__ <span style="color:#000;font-weight:bold">==</span> <span style="color:#d14">&#34;__main__&#34;</span>:
</span></span><span style="display:flex;"><span>    main()
</span></span></code></pre></td></tr></table>
</div>
</div><h3 id="36-漏斗图">3.6 漏斗图</h3>
<table>
<thead>
<tr>
<th>说明</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td>适用场景</td>
<td>漏斗图适用于业务流程多的流程分析，显示各流程的转化率。</td>
</tr>
<tr>
<td>优势</td>
<td>在网站分析中，通常用于转化率比较，它不仅能展示用户从进入网站到实现购买的最终转化率，还可以展示每个步骤的转化率，能够直观地发现和说明问题所在。</td>
</tr>
<tr>
<td>劣势</td>
<td>单一漏斗图无法评价网站某个关键流程中各步骤转化率的好坏。</td>
</tr>
</tbody>
</table>
<h4 id="demo-5">demo:</h4>
<div class="highlight"><div style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">
<table style="border-spacing:0;padding:0;margin:0;border:0;"><tr><td style="vertical-align:top;padding:0;margin:0;border:0;">
<pre tabindex="0" style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code></code></pre></td>
<td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
<pre tabindex="0" style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-python" data-lang="python"></code></pre></td></tr></table>
</div>
</div><h3 id="37-雷达图">3.7 雷达图</h3>
<table>
<thead>
<tr>
<th>说明</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td>适用场景</td>
<td>雷达图适用于多维数据（四维以上），一般是用来表示某个数据字段的综合情况，数据点一般6个左右，太多的话辨别起来有困难。</td>
</tr>
<tr>
<td>优势</td>
<td>主要用来了解公司各项数据指标的变动情形及其好坏趋向。</td>
</tr>
<tr>
<td>劣势</td>
<td>理解成本较高。</td>
</tr>
</tbody>
</table>
<h4 id="demo-6">demo：</h4>
<div class="highlight"><div style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">
<table style="border-spacing:0;padding:0;margin:0;border:0;"><tr><td style="vertical-align:top;padding:0;margin:0;border:0;">
<pre tabindex="0" style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">  1
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">  2
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">  3
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">  4
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">  5
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">  6
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">  7
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">  8
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">  9
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 10
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 11
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 12
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 13
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 14
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 15
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 16
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 17
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 18
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 19
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 20
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 21
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 22
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 23
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 24
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 25
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 26
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 27
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 28
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 29
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 30
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 31
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 32
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 33
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 34
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 35
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 36
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 37
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 38
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 39
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 40
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 41
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 42
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 43
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 44
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 45
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 46
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 47
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 48
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 49
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 50
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 51
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 52
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 53
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 54
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 55
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 56
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 57
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 58
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 59
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 60
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 61
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 62
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 63
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 64
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 65
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 66
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 67
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 68
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 69
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 70
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 71
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 72
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 73
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 74
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 75
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 76
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 77
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 78
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 79
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 80
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 81
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 82
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 83
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 84
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 85
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 86
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 87
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 88
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 89
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 90
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 91
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 92
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 93
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 94
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 95
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 96
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 97
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 98
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 99
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">100
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">101
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">102
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">103
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">104
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">105
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">106
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">107
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">108
</span></code></pre></td>
<td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
<pre tabindex="0" style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-python" data-lang="python"><span style="display:flex;"><span><span style="color:#998;font-style:italic"># !/usr/bin/python3</span>
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># -*- coding: utf-8 -*-</span>
</span></span><span style="display:flex;"><span><span style="color:#d14">&#34;&#34;&#34;
</span></span></span><span style="display:flex;"><span><span style="color:#d14">@Description    :  雷达图
</span></span></span><span style="display:flex;"><span><span style="color:#d14">@Author         :  Anttu
</span></span></span><span style="display:flex;"><span><span style="color:#d14">@Version        :  v1.0
</span></span></span><span style="display:flex;"><span><span style="color:#d14">@File           :  testRadar.py
</span></span></span><span style="display:flex;"><span><span style="color:#d14">@CreateTime     :  8/6/2021 10:00
</span></span></span><span style="display:flex;"><span><span style="color:#d14">&#34;&#34;&#34;</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">import</span> <span style="color:#555">pandas</span> <span style="color:#000;font-weight:bold">as</span> <span style="color:#555">pd</span>
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">import</span> <span style="color:#555">matplotlib.pyplot</span> <span style="color:#000;font-weight:bold">as</span> <span style="color:#555">plt</span>
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">import</span> <span style="color:#555">numpy</span> <span style="color:#000;font-weight:bold">as</span> <span style="color:#555">np</span>
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">import</span> <span style="color:#555">os</span>
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">import</span> <span style="color:#555">platform</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># 系统</span>
</span></span><span style="display:flex;"><span><span style="color:#0086b3">print</span>(platform<span style="color:#000;font-weight:bold">.</span>system())
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># 相对路径</span>
</span></span><span style="display:flex;"><span>project_dir <span style="color:#000;font-weight:bold">=</span> os<span style="color:#000;font-weight:bold">.</span>path<span style="color:#000;font-weight:bold">.</span>abspath(<span style="color:#d14">&#39;.&#39;</span>)
</span></span><span style="display:flex;"><span><span style="color:#0086b3">print</span>(project_dir)
</span></span><span style="display:flex;"><span>fileName <span style="color:#000;font-weight:bold">=</span> <span style="color:#d14">&#34;ninjas.csv&#34;</span>
</span></span><span style="display:flex;"><span>outFileName <span style="color:#000;font-weight:bold">=</span> <span style="color:#d14">&#34;request_radar_ninja_&#34;</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>fontName <span style="color:#000;font-weight:bold">=</span> <span style="color:#d14">&#34;SimHei&#34;</span>
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">if</span> platform<span style="color:#000;font-weight:bold">.</span>system() <span style="color:#000;font-weight:bold">==</span> <span style="color:#d14">&#39;Windows&#39;</span>:
</span></span><span style="display:flex;"><span>    <span style="color:#0086b3">print</span>(<span style="color:#d14">&#39;Windows系统&#39;</span>)
</span></span><span style="display:flex;"><span>    fontName <span style="color:#000;font-weight:bold">=</span> [<span style="color:#d14">&#34;SimHei&#34;</span>]
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">elif</span> platform<span style="color:#000;font-weight:bold">.</span>system() <span style="color:#000;font-weight:bold">==</span> <span style="color:#d14">&#39;Linux&#39;</span>:
</span></span><span style="display:flex;"><span>    <span style="color:#0086b3">print</span>(<span style="color:#d14">&#39;Linux系统&#39;</span>)
</span></span><span style="display:flex;"><span>    fontName <span style="color:#000;font-weight:bold">=</span> [<span style="color:#d14">&#34;SimHei&#34;</span>]
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">elif</span> platform<span style="color:#000;font-weight:bold">.</span>system() <span style="color:#000;font-weight:bold">==</span> <span style="color:#d14">&#39;Darwin&#39;</span>:
</span></span><span style="display:flex;"><span>    <span style="color:#0086b3">print</span>(<span style="color:#d14">&#39;MacOS系统&#39;</span>)
</span></span><span style="display:flex;"><span>    fontName <span style="color:#000;font-weight:bold">=</span> [<span style="color:#d14">&#34;PingFang HK&#34;</span>]
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">else</span>:
</span></span><span style="display:flex;"><span>    <span style="color:#0086b3">print</span>(<span style="color:#d14">&#39;其他&#39;</span>)
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># Mac字体 PingFang HK</span>
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># win字体 SimHei</span>
</span></span><span style="display:flex;"><span>plt<span style="color:#000;font-weight:bold">.</span>rcParams[<span style="color:#d14">&#39;font.sans-serif&#39;</span>] <span style="color:#000;font-weight:bold">=</span> fontName
</span></span><span style="display:flex;"><span>plt<span style="color:#000;font-weight:bold">.</span>rcParams[<span style="color:#d14">&#39;font.family&#39;</span>] <span style="color:#000;font-weight:bold">=</span> <span style="color:#d14">&#39;sans-serif&#39;</span>
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># 解决负号&#39;-&#39;显示为方块的问题</span>
</span></span><span style="display:flex;"><span>plt<span style="color:#000;font-weight:bold">.</span>rcParams[<span style="color:#d14">&#39;axes.unicode_minus&#39;</span>] <span style="color:#000;font-weight:bold">=</span> <span style="color:#000;font-weight:bold">False</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>filePath <span style="color:#000;font-weight:bold">=</span> os<span style="color:#000;font-weight:bold">.</span>sep<span style="color:#000;font-weight:bold">.</span>join([project_dir, fileName])
</span></span><span style="display:flex;"><span>outPath <span style="color:#000;font-weight:bold">=</span> os<span style="color:#000;font-weight:bold">.</span>sep<span style="color:#000;font-weight:bold">.</span>join([project_dir, outFileName])
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># 全路径</span>
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># filePath = &#34;D:\\request.csv&#34;</span>
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># outPath = &#34;D:\\request.jpg&#34;</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">def</span> <span style="color:#900;font-weight:bold">main</span>():
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># 使用python下pandas库读取csv文件</span>
</span></span><span style="display:flex;"><span>    data <span style="color:#000;font-weight:bold">=</span> pd<span style="color:#000;font-weight:bold">.</span>read_csv(filePath, encoding<span style="color:#000;font-weight:bold">=</span><span style="color:#d14">&#39;utf-8&#39;</span>)
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># 读取列名</span>
</span></span><span style="display:flex;"><span>    ability_name <span style="color:#000;font-weight:bold">=</span> data<span style="color:#000;font-weight:bold">.</span>loc[:, <span style="color:#d14">&#39;忍&#39;</span>:<span style="color:#d14">&#39;印&#39;</span>]
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># 名称列</span>
</span></span><span style="display:flex;"><span>    ability_value <span style="color:#000;font-weight:bold">=</span> data<span style="color:#000;font-weight:bold">.</span>loc[:, ]
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># 能力值的名称，需要去掉姓名和合计才可以放到雷达图中</span>
</span></span><span style="display:flex;"><span>    col_names <span style="color:#000;font-weight:bold">=</span> data<span style="color:#000;font-weight:bold">.</span>keys()
</span></span><span style="display:flex;"><span>    labels <span style="color:#000;font-weight:bold">=</span> col_names<span style="color:#000;font-weight:bold">.</span>drop([<span style="color:#d14">&#39;姓名&#39;</span>, <span style="color:#d14">&#39;合计&#39;</span>])
</span></span><span style="display:flex;"><span>    data_length <span style="color:#000;font-weight:bold">=</span> <span style="color:#0086b3">len</span>(labels)
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># labels里有几个数据，就把整圆360°分成几份，设置雷达图的角度，用于平分切开一个平面</span>
</span></span><span style="display:flex;"><span>    angle <span style="color:#000;font-weight:bold">=</span> np<span style="color:#000;font-weight:bold">.</span>linspace(<span style="color:#099">0</span>, <span style="color:#099">2</span> <span style="color:#000;font-weight:bold">*</span> np<span style="color:#000;font-weight:bold">.</span>pi, data_length, endpoint<span style="color:#000;font-weight:bold">=</span><span style="color:#000;font-weight:bold">False</span>)
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># 使雷达图封闭起来</span>
</span></span><span style="display:flex;"><span>    labels <span style="color:#000;font-weight:bold">=</span> np<span style="color:#000;font-weight:bold">.</span>concatenate((labels, [labels[<span style="color:#099">0</span>]]))
</span></span><span style="display:flex;"><span>    angles <span style="color:#000;font-weight:bold">=</span> np<span style="color:#000;font-weight:bold">.</span>concatenate((angle, [angle[<span style="color:#099">0</span>]]))
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>    <span style="color:#000;font-weight:bold">for</span> index <span style="color:#000;font-weight:bold">in</span> <span style="color:#0086b3">range</span>(<span style="color:#0086b3">len</span>(ability_name)):
</span></span><span style="display:flex;"><span>        <span style="color:#998;font-style:italic"># 技能值</span>
</span></span><span style="display:flex;"><span>        result <span style="color:#000;font-weight:bold">=</span> ability_name<span style="color:#000;font-weight:bold">.</span>iloc[index]<span style="color:#000;font-weight:bold">.</span>values
</span></span><span style="display:flex;"><span>        <span style="color:#998;font-style:italic"># 使雷达图封闭起来</span>
</span></span><span style="display:flex;"><span>        values <span style="color:#000;font-weight:bold">=</span> np<span style="color:#000;font-weight:bold">.</span>concatenate((result, [result[<span style="color:#099">0</span>]]))
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>        <span style="color:#998;font-style:italic"># 设置画布</span>
</span></span><span style="display:flex;"><span>        fig <span style="color:#000;font-weight:bold">=</span> plt<span style="color:#000;font-weight:bold">.</span>figure(dpi<span style="color:#000;font-weight:bold">=</span><span style="color:#099">100</span>, figsize<span style="color:#000;font-weight:bold">=</span>(<span style="color:#099">8</span>, <span style="color:#099">6</span>))
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>        <span style="color:#998;font-style:italic"># 设置为极坐标格式</span>
</span></span><span style="display:flex;"><span>        ax <span style="color:#000;font-weight:bold">=</span> fig<span style="color:#000;font-weight:bold">.</span>add_subplot(<span style="color:#099">111</span>, polar<span style="color:#000;font-weight:bold">=</span><span style="color:#000;font-weight:bold">True</span>)
</span></span><span style="display:flex;"><span>        <span style="color:#998;font-style:italic"># 绘制折线图</span>
</span></span><span style="display:flex;"><span>        ax<span style="color:#000;font-weight:bold">.</span>plot(angles, values, <span style="color:#d14">&#39;o-&#39;</span>, linewidth<span style="color:#000;font-weight:bold">=</span><span style="color:#099">1</span>)
</span></span><span style="display:flex;"><span>        ax<span style="color:#000;font-weight:bold">.</span>fill(angles, values, <span style="color:#d14">&#39;r&#39;</span>, alpha<span style="color:#000;font-weight:bold">=</span><span style="color:#099">0.5</span>)
</span></span><span style="display:flex;"><span>        <span style="color:#998;font-style:italic"># 添加每个特质的标签</span>
</span></span><span style="display:flex;"><span>        ax<span style="color:#000;font-weight:bold">.</span>set_thetagrids(angles <span style="color:#000;font-weight:bold">*</span> <span style="color:#099">180</span> <span style="color:#000;font-weight:bold">/</span> np<span style="color:#000;font-weight:bold">.</span>pi, labels)
</span></span><span style="display:flex;"><span>        <span style="color:#998;font-style:italic"># 设置极轴范围</span>
</span></span><span style="display:flex;"><span>        ax<span style="color:#000;font-weight:bold">.</span>set_rlim(<span style="color:#099">0</span>, <span style="color:#099">10</span>)
</span></span><span style="display:flex;"><span>        <span style="color:#998;font-style:italic"># 设置雷达图的坐标值显示角度，相对于起始角度的偏移量</span>
</span></span><span style="display:flex;"><span>        ax<span style="color:#000;font-weight:bold">.</span>set_rlabel_position(<span style="color:#099">360</span>)
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>        <span style="color:#998;font-style:italic"># 统计图的标题</span>
</span></span><span style="display:flex;"><span>        title_name <span style="color:#000;font-weight:bold">=</span> <span style="color:#d14">&#39;火影 - &#39;</span> <span style="color:#000;font-weight:bold">+</span> ability_value[<span style="color:#d14">&#39;姓名&#39;</span>][index] <span style="color:#000;font-weight:bold">+</span> <span style="color:#d14">&#39; === 合计[&#39;</span> <span style="color:#000;font-weight:bold">+</span> <span style="color:#0086b3">str</span>(ability_value[<span style="color:#d14">&#39;合计&#39;</span>][index]) <span style="color:#000;font-weight:bold">+</span> <span style="color:#d14">&#39;]&#39;</span>
</span></span><span style="display:flex;"><span>        plt<span style="color:#000;font-weight:bold">.</span>title(title_name, size<span style="color:#000;font-weight:bold">=</span><span style="color:#099">14</span>)
</span></span><span style="display:flex;"><span>        <span style="color:#998;font-style:italic"># 网格</span>
</span></span><span style="display:flex;"><span>        plt<span style="color:#000;font-weight:bold">.</span>grid(<span style="color:#000;font-weight:bold">True</span>)
</span></span><span style="display:flex;"><span>        <span style="color:#998;font-style:italic"># 在展示图片前可以将画出的曲线保存到自己路径下的文件夹中</span>
</span></span><span style="display:flex;"><span>        plt<span style="color:#000;font-weight:bold">.</span>savefig(os<span style="color:#000;font-weight:bold">.</span>sep<span style="color:#000;font-weight:bold">.</span>join([project_dir, outFileName <span style="color:#000;font-weight:bold">+</span> ability_value[<span style="color:#d14">&#39;姓名&#39;</span>][index] <span style="color:#000;font-weight:bold">+</span> <span style="color:#d14">&#39;.jpg&#39;</span>]))
</span></span><span style="display:flex;"><span>        <span style="color:#998;font-style:italic"># 显示图像</span>
</span></span><span style="display:flex;"><span>        plt<span style="color:#000;font-weight:bold">.</span>show()
</span></span><span style="display:flex;"><span>    <span style="color:#0086b3">print</span>(<span style="color:#d14">&#34;all picture is starting&#34;</span>)
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">if</span> __name__ <span style="color:#000;font-weight:bold">==</span> <span style="color:#d14">&#34;__main__&#34;</span>:
</span></span><span style="display:flex;"><span>    main()
</span></span></code></pre></td></tr></table>
</div>
</div><h3 id="38-数字地图">3.8 数字地图</h3>
<table>
<thead>
<tr>
<th>说明</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td>适用场景</td>
<td>适用于有空间位置的数据集，一般分成行政地图（气泡图、面积图）和GIS地图。行政地图一般有省份、城市数据就够了（比如福建-泉州）；而GIS地图则需要经纬度数据，更细化到具体区域，只要有数据，可做区域、全国甚至全球的地图。</td>
</tr>
<tr>
<td>优劣势</td>
<td>特殊状况下使用，涉及行政区域。</td>
</tr>
</tbody>
</table>
<h4 id="demo-7">demo：</h4>
<div class="highlight"><div style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">
<table style="border-spacing:0;padding:0;margin:0;border:0;"><tr><td style="vertical-align:top;padding:0;margin:0;border:0;">
<pre tabindex="0" style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code></code></pre></td>
<td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
<pre tabindex="0" style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-python" data-lang="python"></code></pre></td></tr></table>
</div>
</div><h3 id="39-热力图">3.9 热力图</h3>
<table>
<thead>
<tr>
<th>说明</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td>适用场景</td>
<td>适用于有空间位置的数据集，一般分成行政地图（气泡图、面积图）和GIS地图。行政地图一般有省份、城市数据就够了（比如福建-泉州）；而GIS地图则需要经纬度数据，更细化到具体区域，只要有数据，可做区域、全国甚至全球的地图。</td>
</tr>
<tr>
<td>优劣势</td>
<td>特殊状况下使用，涉及行政区域。</td>
</tr>
</tbody>
</table>
<h4 id="demo-8">demo：</h4>
<div class="highlight"><div style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">
<table style="border-spacing:0;padding:0;margin:0;border:0;"><tr><td style="vertical-align:top;padding:0;margin:0;border:0;">
<pre tabindex="0" style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 1
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 2
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 3
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 4
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 5
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 6
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 7
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 8
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 9
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">10
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">11
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">12
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">13
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">14
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">15
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">16
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">17
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">18
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">19
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">20
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">21
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">22
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">23
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">24
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">25
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">26
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">27
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">28
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">29
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">30
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">31
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">32
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">33
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">34
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">35
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">36
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">37
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">38
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">39
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">40
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">41
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">42
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">43
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">44
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">45
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">46
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">47
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">48
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">49
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">50
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">51
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">52
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">53
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">54
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">55
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">56
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">57
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">58
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">59
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">60
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">61
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">62
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">63
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">64
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">65
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">66
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">67
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">68
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">69
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">70
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">71
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">72
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">73
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">74
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">75
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">76
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">77
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">78
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">79
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">80
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">81
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">82
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">83
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">84
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">85
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">86
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">87
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">88
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">89
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">90
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">91
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">92
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">93
</span></code></pre></td>
<td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
<pre tabindex="0" style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-python" data-lang="python"><span style="display:flex;"><span><span style="color:#998;font-style:italic"># !/usr/bin/python3</span>
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># -*- coding: utf-8 -*-</span>
</span></span><span style="display:flex;"><span><span style="color:#d14">&#34;&#34;&#34;
</span></span></span><span style="display:flex;"><span><span style="color:#d14">@Description    :  热力图
</span></span></span><span style="display:flex;"><span><span style="color:#d14">@Author         :  Anttu
</span></span></span><span style="display:flex;"><span><span style="color:#d14">@Version        :  v1.0
</span></span></span><span style="display:flex;"><span><span style="color:#d14">@File           :  testHeatMap.py
</span></span></span><span style="display:flex;"><span><span style="color:#d14">@CreateTime     :  19/5/2021 01:39
</span></span></span><span style="display:flex;"><span><span style="color:#d14">&#34;&#34;&#34;</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">import</span> <span style="color:#555">pandas</span> <span style="color:#000;font-weight:bold">as</span> <span style="color:#555">pd</span>
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">import</span> <span style="color:#555">matplotlib.pyplot</span> <span style="color:#000;font-weight:bold">as</span> <span style="color:#555">plt</span>
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">import</span> <span style="color:#555">numpy</span> <span style="color:#000;font-weight:bold">as</span> <span style="color:#555">np</span>
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">import</span> <span style="color:#555">os</span>
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">import</span> <span style="color:#555">platform</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># 系统</span>
</span></span><span style="display:flex;"><span><span style="color:#0086b3">print</span>(platform<span style="color:#000;font-weight:bold">.</span>system())
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># 相对路径</span>
</span></span><span style="display:flex;"><span>project_dir <span style="color:#000;font-weight:bold">=</span> os<span style="color:#000;font-weight:bold">.</span>path<span style="color:#000;font-weight:bold">.</span>abspath(<span style="color:#d14">&#39;.&#39;</span>)
</span></span><span style="display:flex;"><span><span style="color:#0086b3">print</span>(project_dir)
</span></span><span style="display:flex;"><span>fileName <span style="color:#000;font-weight:bold">=</span> <span style="color:#d14">&#34;heatmap.csv&#34;</span>
</span></span><span style="display:flex;"><span>outFileName <span style="color:#000;font-weight:bold">=</span> <span style="color:#d14">&#34;request_heatmap.jpg&#34;</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>fontName <span style="color:#000;font-weight:bold">=</span> <span style="color:#d14">&#34;SimHei&#34;</span>
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">if</span> platform<span style="color:#000;font-weight:bold">.</span>system() <span style="color:#000;font-weight:bold">==</span> <span style="color:#d14">&#39;Windows&#39;</span>:
</span></span><span style="display:flex;"><span>    <span style="color:#0086b3">print</span>(<span style="color:#d14">&#39;Windows系统&#39;</span>)
</span></span><span style="display:flex;"><span>    fontName <span style="color:#000;font-weight:bold">=</span> [<span style="color:#d14">&#34;SimHei&#34;</span>]
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">elif</span> platform<span style="color:#000;font-weight:bold">.</span>system() <span style="color:#000;font-weight:bold">==</span> <span style="color:#d14">&#39;Linux&#39;</span>:
</span></span><span style="display:flex;"><span>    <span style="color:#0086b3">print</span>(<span style="color:#d14">&#39;Linux系统&#39;</span>)
</span></span><span style="display:flex;"><span>    fontName <span style="color:#000;font-weight:bold">=</span> [<span style="color:#d14">&#34;SimHei&#34;</span>]
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">elif</span> platform<span style="color:#000;font-weight:bold">.</span>system() <span style="color:#000;font-weight:bold">==</span> <span style="color:#d14">&#39;Darwin&#39;</span>:
</span></span><span style="display:flex;"><span>    <span style="color:#0086b3">print</span>(<span style="color:#d14">&#39;MacOS系统&#39;</span>)
</span></span><span style="display:flex;"><span>    fontName <span style="color:#000;font-weight:bold">=</span> [<span style="color:#d14">&#34;PingFang HK&#34;</span>]
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">else</span>:
</span></span><span style="display:flex;"><span>    <span style="color:#0086b3">print</span>(<span style="color:#d14">&#39;其他&#39;</span>)
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># Mac字体 PingFang HK</span>
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># win字体 SimHei</span>
</span></span><span style="display:flex;"><span>plt<span style="color:#000;font-weight:bold">.</span>rcParams[<span style="color:#d14">&#39;font.sans-serif&#39;</span>] <span style="color:#000;font-weight:bold">=</span> fontName
</span></span><span style="display:flex;"><span>plt<span style="color:#000;font-weight:bold">.</span>rcParams[<span style="color:#d14">&#39;font.family&#39;</span>] <span style="color:#000;font-weight:bold">=</span> <span style="color:#d14">&#39;sans-serif&#39;</span>
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># 解决负号&#39;-&#39;显示为方块的问题</span>
</span></span><span style="display:flex;"><span>plt<span style="color:#000;font-weight:bold">.</span>rcParams[<span style="color:#d14">&#39;axes.unicode_minus&#39;</span>] <span style="color:#000;font-weight:bold">=</span> <span style="color:#000;font-weight:bold">False</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>filePath <span style="color:#000;font-weight:bold">=</span> os<span style="color:#000;font-weight:bold">.</span>sep<span style="color:#000;font-weight:bold">.</span>join([project_dir, fileName])
</span></span><span style="display:flex;"><span>outPath <span style="color:#000;font-weight:bold">=</span> os<span style="color:#000;font-weight:bold">.</span>sep<span style="color:#000;font-weight:bold">.</span>join([project_dir, outFileName])
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># 全路径</span>
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># filePath = &#34;D:\\request.csv&#34;</span>
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># outPath = &#34;D:\\request.jpg&#34;</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">def</span> <span style="color:#900;font-weight:bold">main</span>():
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># 使用python下pandas库读取csv文件</span>
</span></span><span style="display:flex;"><span>    data_nba <span style="color:#000;font-weight:bold">=</span> pd<span style="color:#000;font-weight:bold">.</span>read_csv(filePath, encoding<span style="color:#000;font-weight:bold">=</span><span style="color:#d14">&#39;utf-8&#39;</span>)
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># 读取列名</span>
</span></span><span style="display:flex;"><span>    score <span style="color:#000;font-weight:bold">=</span> data_nba<span style="color:#000;font-weight:bold">.</span>loc[:, <span style="color:#d14">&#34;G&#34;</span>:<span style="color:#d14">&#34;PF&#34;</span>]<span style="color:#000;font-weight:bold">.</span>values
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># 名称列</span>
</span></span><span style="display:flex;"><span>    name <span style="color:#000;font-weight:bold">=</span> data_nba<span style="color:#000;font-weight:bold">.</span>iloc[:, <span style="color:#099">0</span>]
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># 技术指标行</span>
</span></span><span style="display:flex;"><span>    col <span style="color:#000;font-weight:bold">=</span> data_nba<span style="color:#000;font-weight:bold">.</span>loc[:, <span style="color:#d14">&#34;G&#34;</span>:<span style="color:#d14">&#34;PF&#34;</span>]<span style="color:#000;font-weight:bold">.</span>columns
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># 设置画布</span>
</span></span><span style="display:flex;"><span>    fig <span style="color:#000;font-weight:bold">=</span> plt<span style="color:#000;font-weight:bold">.</span>figure(dpi<span style="color:#000;font-weight:bold">=</span><span style="color:#099">100</span>, figsize<span style="color:#000;font-weight:bold">=</span>(<span style="color:#099">24</span>, <span style="color:#099">32</span>))
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># 散点图的变种气泡图</span>
</span></span><span style="display:flex;"><span>    im <span style="color:#000;font-weight:bold">=</span> plt<span style="color:#000;font-weight:bold">.</span>imshow(score, cmap<span style="color:#000;font-weight:bold">=</span><span style="color:#d14">&#39;plasma_r&#39;</span>)
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># 设置X轴刻度</span>
</span></span><span style="display:flex;"><span>    plt<span style="color:#000;font-weight:bold">.</span>xticks(np<span style="color:#000;font-weight:bold">.</span>arange(<span style="color:#0086b3">len</span>(col)), col<span style="color:#000;font-weight:bold">.</span>values)
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># 设置Y轴刻度</span>
</span></span><span style="display:flex;"><span>    plt<span style="color:#000;font-weight:bold">.</span>yticks(np<span style="color:#000;font-weight:bold">.</span>arange(<span style="color:#0086b3">len</span>(name)), name<span style="color:#000;font-weight:bold">.</span>values)
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># 显示图例</span>
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># plt.legend()</span>
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># 设置颜色条</span>
</span></span><span style="display:flex;"><span>    fig<span style="color:#000;font-weight:bold">.</span>colorbar(im, pad<span style="color:#000;font-weight:bold">=</span><span style="color:#099">0.03</span>)
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># X坐标-横坐标标题</span>
</span></span><span style="display:flex;"><span>    plt<span style="color:#000;font-weight:bold">.</span>xlabel(<span style="color:#d14">u</span><span style="color:#d14">&#39;技术指标&#39;</span>, size<span style="color:#000;font-weight:bold">=</span><span style="color:#099">24</span>)
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># Y坐标-纵坐标标题</span>
</span></span><span style="display:flex;"><span>    plt<span style="color:#000;font-weight:bold">.</span>ylabel(<span style="color:#d14">u</span><span style="color:#d14">&#39;姓名&#39;</span>, size<span style="color:#000;font-weight:bold">=</span><span style="color:#099">24</span>)
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># 统计图的标题</span>
</span></span><span style="display:flex;"><span>    plt<span style="color:#000;font-weight:bold">.</span>title(<span style="color:#d14">u</span><span style="color:#d14">&#34;NBA Average Performance (Top 50 Players)&#34;</span>, size<span style="color:#000;font-weight:bold">=</span><span style="color:#099">32</span>)
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># 网格</span>
</span></span><span style="display:flex;"><span>    plt<span style="color:#000;font-weight:bold">.</span>grid(<span style="color:#000;font-weight:bold">True</span>)
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># 在展示图片前可以将画出的曲线保存到自己路径下的文件夹中</span>
</span></span><span style="display:flex;"><span>    plt<span style="color:#000;font-weight:bold">.</span>savefig(outPath)
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># 显示图像</span>
</span></span><span style="display:flex;"><span>    plt<span style="color:#000;font-weight:bold">.</span>show()
</span></span><span style="display:flex;"><span>    <span style="color:#0086b3">print</span>(<span style="color:#d14">&#34;all picture is starting&#34;</span>)
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">if</span> __name__ <span style="color:#000;font-weight:bold">==</span> <span style="color:#d14">&#34;__main__&#34;</span>:
</span></span><span style="display:flex;"><span>    main()
</span></span></code></pre></td></tr></table>
</div>
</div><h3 id="310-气泡图">3.10 气泡图</h3>
<table>
<thead>
<tr>
<th>说明</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td>适用场景</td>
<td>适用于有空间位置的数据集，一般分成行政地图（气泡图、面积图）和GIS地图。行政地图一般有省份、城市数据就够了（比如福建-泉州）；而GIS地图则需要经纬度数据，更细化到具体区域，只要有数据，可做区域、全国甚至全球的地图。</td>
</tr>
<tr>
<td>优劣势</td>
<td>特殊状况下使用，涉及行政区域。</td>
</tr>
</tbody>
</table>
<h4 id="demo-9">demo：</h4>
<div class="highlight"><div style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">
<table style="border-spacing:0;padding:0;margin:0;border:0;"><tr><td style="vertical-align:top;padding:0;margin:0;border:0;">
<pre tabindex="0" style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 1
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 2
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 3
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 4
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 5
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 6
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 7
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 8
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 9
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">10
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">11
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">12
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">13
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">14
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">15
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">16
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">17
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">18
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">19
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">20
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">21
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">22
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">23
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">24
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">25
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">26
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">27
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">28
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">29
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">30
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">31
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">32
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">33
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">34
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">35
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">36
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">37
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">38
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">39
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">40
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">41
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">42
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">43
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">44
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">45
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">46
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">47
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">48
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">49
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">50
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">51
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">52
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">53
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">54
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">55
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">56
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">57
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">58
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">59
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">60
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">61
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">62
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">63
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">64
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">65
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">66
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">67
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">68
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">69
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">70
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">71
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">72
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">73
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">74
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">75
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">76
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">77
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">78
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">79
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">80
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">81
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">82
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">83
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">84
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">85
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">86
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">87
</span></code></pre></td>
<td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
<pre tabindex="0" style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-python" data-lang="python"><span style="display:flex;"><span><span style="color:#998;font-style:italic"># !/usr/bin/python3</span>
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># -*- coding: utf-8 -*-</span>
</span></span><span style="display:flex;"><span><span style="color:#d14">&#34;&#34;&#34;
</span></span></span><span style="display:flex;"><span><span style="color:#d14">@Description    :  气泡图
</span></span></span><span style="display:flex;"><span><span style="color:#d14">@Author         :  Anttu
</span></span></span><span style="display:flex;"><span><span style="color:#d14">@Version        :  v1.0
</span></span></span><span style="display:flex;"><span><span style="color:#d14">@File           :  testBubble.py
</span></span></span><span style="display:flex;"><span><span style="color:#d14">@CreateTime     :  7/6/2021 15:38
</span></span></span><span style="display:flex;"><span><span style="color:#d14">&#34;&#34;&#34;</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">import</span> <span style="color:#555">pandas</span> <span style="color:#000;font-weight:bold">as</span> <span style="color:#555">pd</span>
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">import</span> <span style="color:#555">matplotlib.pyplot</span> <span style="color:#000;font-weight:bold">as</span> <span style="color:#555">plt</span>
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">import</span> <span style="color:#555">numpy</span> <span style="color:#000;font-weight:bold">as</span> <span style="color:#555">np</span>
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">import</span> <span style="color:#555">os</span>
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">import</span> <span style="color:#555">platform</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># 系统</span>
</span></span><span style="display:flex;"><span><span style="color:#0086b3">print</span>(platform<span style="color:#000;font-weight:bold">.</span>system())
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># 相对路径</span>
</span></span><span style="display:flex;"><span>project_dir <span style="color:#000;font-weight:bold">=</span> os<span style="color:#000;font-weight:bold">.</span>path<span style="color:#000;font-weight:bold">.</span>abspath(<span style="color:#d14">&#39;.&#39;</span>)
</span></span><span style="display:flex;"><span><span style="color:#0086b3">print</span>(project_dir)
</span></span><span style="display:flex;"><span>fileName <span style="color:#000;font-weight:bold">=</span> <span style="color:#d14">&#34;bubble.csv&#34;</span>
</span></span><span style="display:flex;"><span>outFileName <span style="color:#000;font-weight:bold">=</span> <span style="color:#d14">&#34;request_bubble.jpg&#34;</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>fontName <span style="color:#000;font-weight:bold">=</span> <span style="color:#d14">&#34;SimHei&#34;</span>
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">if</span> platform<span style="color:#000;font-weight:bold">.</span>system() <span style="color:#000;font-weight:bold">==</span> <span style="color:#d14">&#39;Windows&#39;</span>:
</span></span><span style="display:flex;"><span>    <span style="color:#0086b3">print</span>(<span style="color:#d14">&#39;Windows系统&#39;</span>)
</span></span><span style="display:flex;"><span>    fontName <span style="color:#000;font-weight:bold">=</span> [<span style="color:#d14">&#34;SimHei&#34;</span>]
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">elif</span> platform<span style="color:#000;font-weight:bold">.</span>system() <span style="color:#000;font-weight:bold">==</span> <span style="color:#d14">&#39;Linux&#39;</span>:
</span></span><span style="display:flex;"><span>    <span style="color:#0086b3">print</span>(<span style="color:#d14">&#39;Linux系统&#39;</span>)
</span></span><span style="display:flex;"><span>    fontName <span style="color:#000;font-weight:bold">=</span> [<span style="color:#d14">&#34;SimHei&#34;</span>]
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">elif</span> platform<span style="color:#000;font-weight:bold">.</span>system() <span style="color:#000;font-weight:bold">==</span> <span style="color:#d14">&#39;Darwin&#39;</span>:
</span></span><span style="display:flex;"><span>    <span style="color:#0086b3">print</span>(<span style="color:#d14">&#39;MacOS系统&#39;</span>)
</span></span><span style="display:flex;"><span>    fontName <span style="color:#000;font-weight:bold">=</span> [<span style="color:#d14">&#34;PingFang HK&#34;</span>]
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">else</span>:
</span></span><span style="display:flex;"><span>    <span style="color:#0086b3">print</span>(<span style="color:#d14">&#39;其他&#39;</span>)
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># Mac字体 PingFang HK</span>
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># win字体 SimHei</span>
</span></span><span style="display:flex;"><span>plt<span style="color:#000;font-weight:bold">.</span>rcParams[<span style="color:#d14">&#39;font.sans-serif&#39;</span>] <span style="color:#000;font-weight:bold">=</span> fontName
</span></span><span style="display:flex;"><span>plt<span style="color:#000;font-weight:bold">.</span>rcParams[<span style="color:#d14">&#39;font.family&#39;</span>] <span style="color:#000;font-weight:bold">=</span> <span style="color:#d14">&#39;sans-serif&#39;</span>
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># 解决负号&#39;-&#39;显示为方块的问题</span>
</span></span><span style="display:flex;"><span>plt<span style="color:#000;font-weight:bold">.</span>rcParams[<span style="color:#d14">&#39;axes.unicode_minus&#39;</span>] <span style="color:#000;font-weight:bold">=</span> <span style="color:#000;font-weight:bold">False</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>filePath <span style="color:#000;font-weight:bold">=</span> os<span style="color:#000;font-weight:bold">.</span>sep<span style="color:#000;font-weight:bold">.</span>join([project_dir, fileName])
</span></span><span style="display:flex;"><span>outPath <span style="color:#000;font-weight:bold">=</span> os<span style="color:#000;font-weight:bold">.</span>sep<span style="color:#000;font-weight:bold">.</span>join([project_dir, outFileName])
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># 全路径</span>
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># filePath = &#34;D:\\request.csv&#34;</span>
</span></span><span style="display:flex;"><span><span style="color:#998;font-style:italic"># outPath = &#34;D:\\request.jpg&#34;</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">def</span> <span style="color:#900;font-weight:bold">main</span>():
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># 使用python下pandas库读取csv文件</span>
</span></span><span style="display:flex;"><span>    data <span style="color:#000;font-weight:bold">=</span> pd<span style="color:#000;font-weight:bold">.</span>read_csv(filePath, encoding<span style="color:#000;font-weight:bold">=</span><span style="color:#d14">&#39;utf-8&#39;</span>)
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># 读取列名</span>
</span></span><span style="display:flex;"><span>    value <span style="color:#000;font-weight:bold">=</span> data<span style="color:#000;font-weight:bold">.</span>loc[:, ]
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>    x <span style="color:#000;font-weight:bold">=</span> value[<span style="color:#d14">&#39;x&#39;</span>]
</span></span><span style="display:flex;"><span>    y <span style="color:#000;font-weight:bold">=</span> value[<span style="color:#d14">&#39;y&#39;</span>]
</span></span><span style="display:flex;"><span>    s <span style="color:#000;font-weight:bold">=</span> value[<span style="color:#d14">&#39;size&#39;</span>]<span style="color:#000;font-weight:bold">*</span><span style="color:#099">200</span>
</span></span><span style="display:flex;"><span>    colors <span style="color:#000;font-weight:bold">=</span> value[<span style="color:#d14">&#39;size&#39;</span>]
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># 设置画布</span>
</span></span><span style="display:flex;"><span>    plt<span style="color:#000;font-weight:bold">.</span>figure(dpi<span style="color:#000;font-weight:bold">=</span><span style="color:#099">100</span>, figsize<span style="color:#000;font-weight:bold">=</span>(<span style="color:#099">24</span>, <span style="color:#099">32</span>))
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># 散点图的变种气泡图</span>
</span></span><span style="display:flex;"><span>    plt<span style="color:#000;font-weight:bold">.</span>scatter(x, y, s<span style="color:#000;font-weight:bold">=</span>s, c<span style="color:#000;font-weight:bold">=</span>colors, label<span style="color:#000;font-weight:bold">=</span><span style="color:#d14">&#39;Size值分布&#39;</span>, alpha<span style="color:#000;font-weight:bold">=</span><span style="color:#099">0.5</span>)
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># 显示图例</span>
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># plt.legend(&#39;Size&#39;)</span>
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># X坐标-横坐标标题</span>
</span></span><span style="display:flex;"><span>    plt<span style="color:#000;font-weight:bold">.</span>xlabel(<span style="color:#d14">u</span><span style="color:#d14">&#39;X坐标刻度&#39;</span>, size<span style="color:#000;font-weight:bold">=</span><span style="color:#099">24</span>)
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># Y坐标-纵坐标标题</span>
</span></span><span style="display:flex;"><span>    plt<span style="color:#000;font-weight:bold">.</span>ylabel(<span style="color:#d14">u</span><span style="color:#d14">&#39;Y坐标刻度&#39;</span>, size<span style="color:#000;font-weight:bold">=</span><span style="color:#099">24</span>)
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># 统计图的标题</span>
</span></span><span style="display:flex;"><span>    plt<span style="color:#000;font-weight:bold">.</span>title(<span style="color:#d14">u</span><span style="color:#d14">&#34;XX值分布气泡图&#34;</span>, size<span style="color:#000;font-weight:bold">=</span><span style="color:#099">32</span>)
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># 网格</span>
</span></span><span style="display:flex;"><span>    plt<span style="color:#000;font-weight:bold">.</span>grid(<span style="color:#000;font-weight:bold">True</span>)
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># 在展示图片前可以将画出的曲线保存到自己路径下的文件夹中</span>
</span></span><span style="display:flex;"><span>    plt<span style="color:#000;font-weight:bold">.</span>savefig(outPath)
</span></span><span style="display:flex;"><span>    <span style="color:#998;font-style:italic"># 显示图像</span>
</span></span><span style="display:flex;"><span>    plt<span style="color:#000;font-weight:bold">.</span>show()
</span></span><span style="display:flex;"><span>    <span style="color:#0086b3">print</span>(<span style="color:#d14">&#34;all picture is starting&#34;</span>)
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#000;font-weight:bold">if</span> __name__ <span style="color:#000;font-weight:bold">==</span> <span style="color:#d14">&#34;__main__&#34;</span>:
</span></span><span style="display:flex;"><span>    main()
</span></span></code></pre></td></tr></table>
</div>
</div><h2 id="5demo代码">5、demo代码</h2>
<p>示例的代码仓库： <a href="https://github.com/anTtutu/anttu.code.learn.python/tree/master/matplotlib">https://github.com/anTtutu/anttu.code.learn.python/tree/master/matplotlib</a></p>
<p>其他统计图等后续整理补充&hellip;</p>

        </div>

        
<div class="post-archive">
    <ul class="post-copyright">
        <li><strong>原文作者：</strong><a rel="author" href="https://anttu.gitee.io/">Anttu</a></li>
        <li style="word-break:break-all"><strong>原文链接：</strong><a href="https://anttu.gitee.io/post/2021-04-30-python_matplotlib/">https://anttu.gitee.io/post/2021-04-30-python_matplotlib/</a></li>
        <li><strong>版权声明：</strong>本作品采用<a rel="license" href="https://creativecommons.org/licenses/by-nc-nd/4.0/">知识共享署名-非商业性使用-禁止演绎 4.0 国际许可协议</a>进行许可，非商业转载请注明出处（作者，原文链接），商业转载请联系作者获得授权。</li>
    </ul>
</div>
<br/>



        

<div class="post-archive">
    <h2>See Also</h2>
    <ul class="listing">
        
        <li><a href="/post/2021-04-10-kafka_zookeeper_cluster_install/">kafka集群和zk集群搭建</a></li>
        
        <li><a href="/post/2021-03-29-change_face/">deepfacelab使用介绍</a></li>
        
        <li><a href="/post/2021-03-10-android_termux_java/">android下的termux模拟器安装openJDK和运行springboot项目</a></li>
        
        <li><a href="/post/2021-01-28-miner_virus_2/">挖矿病毒2-分析和排查思路</a></li>
        
        <li><a href="/post/2021-01-16-goland_strange-knowledge/">golang奇怪的知识点</a></li>
        
    </ul>
</div>


        <div class="post-meta meta-tags">
            
            没有标签
            
        </div>
    </article>
    
    

    
    
    <div class="post bg-white">
      <script src="https://utteranc.es/client.js"
            repo= "anTtutu/anTtutu.github.io"
            issue-term="pathname"
            theme="github-light"
            crossorigin="anonymous"
            async>
      </script>
    </div>
    
    
    
</div>

                    <footer id="footer">
    <div>
        &copy; 2025 <a href="https://anttu.gitee.io/">Anttu&#39;s Blog By Anttu</a>
        
    </div>
    <br />
    <div>
        <div class="github-badge">
            <a href="https://gohugo.io/" target="_black" rel="nofollow"><span class="badge-subject">Powered by</span><span class="badge-value bg-blue">Hugo</span></a>
        </div>
        
        <div class="github-badge">
            <a href="https://github.com/flysnow-org/maupassant-hugo" target="_black"><span class="badge-subject">Theme</span><span class="badge-value bg-yellowgreen">Maupassant</span></a>
        </div>
    </div>
</footer>


    
    
    <script type="text/javascript">
        window.MathJax = {
            tex2jax: {
                inlineMath: [['$', '$']],
                processEscapes: true
                }
            };
    </script>
    <script src='//cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-MML-AM_CHTML' async></script>

<a id="rocket" href="#top"></a>
<script type="text/javascript" src='/js/totop.js?v=0.0.0' async=""></script>
<style type="text/css">
div.highlight {
    position: relative;
    margin: 1em 0px;
}

.copy-code {
    display: none;
    position: absolute;
    top: 4px;
    right: 4px;
    color: rgba(255, 255, 255, 0.8);
    background: rgba(78, 78, 78, 0.8);
    border-radius: var(--radius);
    padding: 0 5px;
    font: inherit;
    user-select: none;
    cursor: pointer;
    border: 0;
    --radius: 8px;
}

div.highlight:hover .copy-code,pre:hover .copy-code {
    display: block;
}

</style>
<script>
    document.querySelectorAll('pre > code').forEach((codeblock) => {
        const container = codeblock.parentNode.parentNode;

        const copybutton = document.createElement('button');
        copybutton.classList.add('copy-code');
        copybutton.innerHTML = 'copy';

        function copyingDone() {
            copybutton.innerHTML = 'copied!';
            setTimeout(() => {
                copybutton.innerHTML = 'copy';
            }, 2000);
        }

        copybutton.addEventListener('click', (cb) => {
            if ('clipboard' in navigator) {
                navigator.clipboard.writeText(codeblock.textContent);
                copyingDone();
                return;
            }

            const range = document.createRange();
            range.selectNodeContents(codeblock);
            const selection = window.getSelection();
            selection.removeAllRanges();
            selection.addRange(range);
            try {
                document.execCommand('copy');
                copyingDone();
            } catch (e) { };
            selection.removeRange(range);
        });

        if (container.classList.contains("highlight")) {
            container.appendChild(copybutton);
        } else if (container.parentNode.firstChild == container) {
            
        } else if (codeblock.parentNode.parentNode.parentNode.parentNode.parentNode.nodeName == "TABLE") {
            
            codeblock.parentNode.parentNode.parentNode.parentNode.parentNode.appendChild(copybutton);
        } else {
            
            codeblock.parentNode.appendChild(copybutton);
        }
    });
</script>


    <script type="text/javascript" src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js" async></script>




    <script src='/js/asciinema-player.js'></script>

                </div>

                <div id="secondary">
    <section class="widget">
        <form id="search" action='https://anttu.gitee.io/search' method="get" accept-charset="utf-8" target="_blank" _lpchecked="1">
      
      <input type="text" name="q" maxlength="20" placeholder="Search">
      <input type="hidden" name="sitesearch" value="https://anttu.gitee.io/">
      <button type="submit" class="submit icon-search"></button>
</form>
    </section>
    
    <section class="widget">
        <h3 class="widget-title">最近文章</h3>
<ul class="widget-list">
    
    <li>
        <a href="https://anttu.gitee.io/post/2025-02-13-mvnd/" title="mvnd结合idea使用" target="_blank">mvnd结合idea使用</a>
    </li>
    
    <li>
        <a href="https://anttu.gitee.io/post/2024-04-15-postgresql/" title="postgresql数据库常用记录" target="_blank">postgresql数据库常用记录</a>
    </li>
    
    <li>
        <a href="https://anttu.gitee.io/post/2023-06-16-miner_virus_5/" title="挖矿病毒5-私有云机房挖矿病毒定位" target="_blank">挖矿病毒5-私有云机房挖矿病毒定位</a>
    </li>
    
    <li>
        <a href="https://anttu.gitee.io/post/2022-12-26-covid-19/" title="羊了" target="_blank">羊了</a>
    </li>
    
    <li>
        <a href="https://anttu.gitee.io/post/2022-12-19-git_delete_history/" title="git删除历史提交记录" target="_blank">git删除历史提交记录</a>
    </li>
    
    <li>
        <a href="https://anttu.gitee.io/post/2022-11-28-python_muilt_version/" title="python多版本管理工具" target="_blank">python多版本管理工具</a>
    </li>
    
    <li>
        <a href="https://anttu.gitee.io/post/2022-11-22-springboot_start_failed/" title="springboot常见兼容性错误" target="_blank">springboot常见兼容性错误</a>
    </li>
    
    <li>
        <a href="https://anttu.gitee.io/post/2022-11-14-docker_port/" title="docker修改运行的容器端口" target="_blank">docker修改运行的容器端口</a>
    </li>
    
    <li>
        <a href="https://anttu.gitee.io/post/2022-11-10-go_muilt_version/" title="go多版本管理工具" target="_blank">go多版本管理工具</a>
    </li>
    
    <li>
        <a href="https://anttu.gitee.io/post/2022-10-27-jenkins_reset/" title="jenkins的admin密码忘记了如何重置" target="_blank">jenkins的admin密码忘记了如何重置</a>
    </li>
    
</ul>
    </section>

    

    <section class="widget">
        <h3 class="widget-title"><a href='/categories/'>分类</a></h3>
<ul class="widget-list">
    
    <li><a href="https://anttu.gitee.io/categories/about/">about (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/android/">android (2)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/app/">app (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/aria2/">aria2 (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/arm64/">arm64 (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/arthas/">arthas (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/awr/">awr (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/backend_execute/">backend_execute (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/backup/">backup (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/blog/">blog (3)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/bug/">bug (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/build/">build (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/cache/">cache (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/caffeine/">caffeine (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/captcha/">captcha (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/check/">check (5)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/clean/">clean (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/cli/">cli (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/cluster/">cluster (4)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/covid-19/">covid-19 (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/cve/">cve (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/cygwin/">cygwin (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/dataguard/">dataguard (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/db/">db (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/deepfacelab/">deepfacelab (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/devops/">devops (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/docker/">docker (5)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/dockerfile/">dockerfile (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/dos/">dos (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/dump/">dump (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/eclipse/">eclipse (2)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/explain/">explain (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/faker/">faker (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/gcc/">gcc (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/git/">git (2)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/gitment/">gitment (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/gitpages/">gitpages (2)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/go/">go (5)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/h2/">h2 (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/h5/">h5 (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/ha/">ha (4)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/http/">http (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/hugo/">hugo (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/id/">id (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/idea/">idea (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/java/">java (24)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/jekyll/">jekyll (2)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/jenkins/">jenkins (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/jrebel/">jrebel (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/js/">js (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/jsr/">jsr (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/jvm/">jvm (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/kafka/">kafka (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/kali/">kali (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/kenlm/">kenlm (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/linux/">linux (22)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/log/">log (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/log4j/">log4j (2)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/lombok/">lombok (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/mac/">mac (5)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/matplotlib/">matplotlib (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/maven/">maven (3)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/mine/">mine (5)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/mongodb/">mongodb (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/mvnd/">mvnd (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/mysql/">mysql (5)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/nginx/">nginx (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/nmap/">nmap (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/oom/">oom (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/oracle/">oracle (3)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/orangePi/">orangePi (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/package/">package (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/pandas/">pandas (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/pg/">pg (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/port/">port (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/postgresql/">postgresql (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/python/">python (8)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/rec/">rec (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/redis/">redis (3)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/regexp/">regexp (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/safe/">safe (5)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/sdk/">sdk (3)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/shell/">shell (3)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/split/">split (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/springboot/">springboot (4)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/springcloud/">springcloud (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/sqlmap/">sqlmap (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/ssd/">ssd (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/tcp/">tcp (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/termux/">termux (2)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/test/">test (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/testing/">testing (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/union_id/">union_id (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/vcs/">vcs (7)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/virus/">virus (5)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/vxvm/">vxvm (3)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/win10/">win10 (6)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/xrebel/">xrebel (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/ynote/">ynote (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/zk/">zk (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/zookeeper/">zookeeper (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/%E5%89%8D%E7%AB%AF/">前端 (1)</a></li>
    
    <li><a href="https://anttu.gitee.io/categories/%E5%AE%B9%E7%81%BE/">容灾 (1)</a></li>
    
</ul>
    </section>

    <section class="widget">
        <h3 class="widget-title"><a href='/tags/'>标签</a></h3>
<div class="tagcloud">
    
    <a href="https://anttu.gitee.io/tags/about/">about</a>
    
    <a href="https://anttu.gitee.io/tags/android/">android</a>
    
    <a href="https://anttu.gitee.io/tags/app/">app</a>
    
    <a href="https://anttu.gitee.io/tags/aria2/">aria2</a>
    
    <a href="https://anttu.gitee.io/tags/arm64/">arm64</a>
    
    <a href="https://anttu.gitee.io/tags/awr/">awr</a>
    
    <a href="https://anttu.gitee.io/tags/backup/">backup</a>
    
    <a href="https://anttu.gitee.io/tags/blog/">blog</a>
    
    <a href="https://anttu.gitee.io/tags/bug/">bug</a>
    
    <a href="https://anttu.gitee.io/tags/build/">build</a>
    
    <a href="https://anttu.gitee.io/tags/captcha/">captcha</a>
    
    <a href="https://anttu.gitee.io/tags/check/">check</a>
    
    <a href="https://anttu.gitee.io/tags/cluster/">cluster</a>
    
    <a href="https://anttu.gitee.io/tags/cygwin/">cygwin</a>
    
    <a href="https://anttu.gitee.io/tags/dataguard/">dataguard</a>
    
    <a href="https://anttu.gitee.io/tags/deepfacelab/">deepfacelab</a>
    
    <a href="https://anttu.gitee.io/tags/dos/">dos</a>
    
    <a href="https://anttu.gitee.io/tags/eclipse/">eclipse</a>
    
    <a href="https://anttu.gitee.io/tags/explain/">explain</a>
    
    <a href="https://anttu.gitee.io/tags/gcc/">gcc</a>
    
    <a href="https://anttu.gitee.io/tags/gitment/">gitment</a>
    
    <a href="https://anttu.gitee.io/tags/gitpages/">gitpages</a>
    
    <a href="https://anttu.gitee.io/tags/go/">go</a>
    
    <a href="https://anttu.gitee.io/tags/h2/">h2</a>
    
    <a href="https://anttu.gitee.io/tags/h5/">h5</a>
    
    <a href="https://anttu.gitee.io/tags/ha/">ha</a>
    
    <a href="https://anttu.gitee.io/tags/http/">http</a>
    
    <a href="https://anttu.gitee.io/tags/hugo/">hugo</a>
    
    <a href="https://anttu.gitee.io/tags/java/">java</a>
    
    <a href="https://anttu.gitee.io/tags/jekyll/">jekyll</a>
    
    <a href="https://anttu.gitee.io/tags/jrebel/">jrebel</a>
    
    <a href="https://anttu.gitee.io/tags/js/">js</a>
    
    <a href="https://anttu.gitee.io/tags/jsr/">jsr</a>
    
    <a href="https://anttu.gitee.io/tags/kafka/">kafka</a>
    
    <a href="https://anttu.gitee.io/tags/kali/">kali</a>
    
    <a href="https://anttu.gitee.io/tags/kenlm/">kenlm</a>
    
    <a href="https://anttu.gitee.io/tags/linux/">linux</a>
    
    <a href="https://anttu.gitee.io/tags/log4j/">log4j</a>
    
    <a href="https://anttu.gitee.io/tags/mac/">mac</a>
    
    <a href="https://anttu.gitee.io/tags/mine/">mine</a>
    
    <a href="https://anttu.gitee.io/tags/mongodb/">mongodb</a>
    
    <a href="https://anttu.gitee.io/tags/mysql/">mysql</a>
    
    <a href="https://anttu.gitee.io/tags/nginx/">nginx</a>
    
    <a href="https://anttu.gitee.io/tags/oom/">oom</a>
    
    <a href="https://anttu.gitee.io/tags/oracle/">oracle</a>
    
    <a href="https://anttu.gitee.io/tags/orangePi/">orangePi</a>
    
    <a href="https://anttu.gitee.io/tags/python/">python</a>
    
    <a href="https://anttu.gitee.io/tags/rec/">rec</a>
    
    <a href="https://anttu.gitee.io/tags/redis/">redis</a>
    
    <a href="https://anttu.gitee.io/tags/safe/">safe</a>
    
    <a href="https://anttu.gitee.io/tags/shell/">shell</a>
    
    <a href="https://anttu.gitee.io/tags/springboot/">springboot</a>
    
    <a href="https://anttu.gitee.io/tags/sqlmap/">sqlmap</a>
    
    <a href="https://anttu.gitee.io/tags/ssd/">ssd</a>
    
    <a href="https://anttu.gitee.io/tags/tcp/">tcp</a>
    
    <a href="https://anttu.gitee.io/tags/termux/">termux</a>
    
    <a href="https://anttu.gitee.io/tags/union_id/">union_id</a>
    
    <a href="https://anttu.gitee.io/tags/vcs/">vcs</a>
    
    <a href="https://anttu.gitee.io/tags/virus/">virus</a>
    
    <a href="https://anttu.gitee.io/tags/vxvm/">vxvm</a>
    
    <a href="https://anttu.gitee.io/tags/win10/">win10</a>
    
    <a href="https://anttu.gitee.io/tags/xrebel/">xrebel</a>
    
    <a href="https://anttu.gitee.io/tags/ynote/">ynote</a>
    
    <a href="https://anttu.gitee.io/tags/zk/">zk</a>
    
    <a href="https://anttu.gitee.io/tags/zookeeper/">zookeeper</a>
    
    <a href="https://anttu.gitee.io/tags/%E5%AE%B9%E7%81%BE/">容灾</a>
    
</div>
    </section>

    

    <section class="widget">
        <h3 class="widget-title">其它</h3>
        <ul class="widget-list">
            <li><a href="https://anttu.gitee.io/index.xml">文章 RSS</a></li>
        </ul>
    </section>
</div>
            </div>
        </div>
    </div>
</body>

</html>